python - flask socket-io, sometimes client calls freeze the server -


i have problem flask socket-io freezing, , have no clue how fix it.

my client connects socket-io server , performs chat sessions. works nicely. reason, client side, there call blocks whole server (the server stuck in process, , other calls frozen). strange server can blocked long client side app not totally shutdown.this ios-app / web page, , must totally close app or safari page. closing socket itself, , deallocating doesn't resolve problem. when app in background, sockets closed , deallocated problem persists.

this small server, , deals both html pages , socket-server have no idea if socket or html blocks process. each time server freezing, log showed socket calls.

here how configured server:

socketio = socketio(app, ping_timeout=5) socketio.run(app, host='0.0.0.0', port=5001, debug=true, ssl_context=context) 

so question is: can freeze server (this seems happen when leave app or web-site open long time while doing nothing). if use services server never freezes. , how can prevent happening (even if don't know causing this, there way blindly stop server being stuck @ call?

thanks answers

according comment above, using flask development web server, without of asynchronous framework such eventlet or gevent. besides option being highly inefficient, should know web server not battle tested, meant short lived tests during development. i'm not sure able run long, specially under unusual conditions flask-socketio puts through, regular flask apps not exercise. think quite possible hitting obscure bug in werkzeug causes hang.

my recommendation install eventlet , try again. need pip install eventlet, , assuming not passing explicit async_mode argument, installing package flask-socketio should configure use it.

i remove explicit timeout setting. in cases, defaults sufficient maintain healthy connection.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -