Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uwsgi,gevent, for production #427

Closed
dengxuesong opened this issue Mar 15, 2017 · 1 comment
Closed

uwsgi,gevent, for production #427

dengxuesong opened this issue Mar 15, 2017 · 1 comment
Assignees
Labels

Comments

@dengxuesong
Copy link

i use uwsgi,gevent to deploy production environment, the uwsgi only can use one process,one worker,(the server is flask,and the client is ios & android,i use this to develop app client,not browser)if too many processes and workeres,this will cause session invalid,but one process on work,sometimes will produce the error like this

[pid: 4876|app: 0|req: 14/11] 127.0.0.1 () {40 vars in 755 bytes} [Wed Mar 15 12:34:42 2017] GET /socket.io/?transport=polling&b64=1&token=81ff4591a14bd21a61afbd8fdce7f230&uid=32955967&gid=118&ssid=0 => generated 117 bytes in 4 msecs (HTTP/1.1 200) 4 headers in 181 bytes (3 switches on core 496)
Traceback (most recent call last):
File "/www/pyenv/lib/python2.7/site-packages/flask/app.py", line 1994, in call
return self.wsgi_app(environ, start_response)
File "/www/pyenv/lib/python2.7/site-packages/flask_socketio/init.py", line 42, in call
start_response)
File "/www/pyenv/lib/python2.7/site-packages/engineio/middleware.py", line 47, in call
return self.engineio_app.handle_request(environ, start_response)
File "/www/pyenv/lib/python2.7/site-packages/socketio/server.py", line 353, in handle_request
return self.eio.handle_request(environ, start_response)
File "/www/pyenv/lib/python2.7/site-packages/engineio/server.py", line 278, in handle_request
socket.handle_post_request(environ)
File "/www/pyenv/lib/python2.7/site-packages/engineio/socket.py", line 105, in handle_post_request
self.receive(pkt)
File "/www/pyenv/lib/python2.7/site-packages/engineio/socket.py", line 55, in receive
async=self.server.async_handlers)
File "/www/pyenv/lib/python2.7/site-packages/engineio/server.py", line 378, in _trigger_event
return self.handlersevent
File "/www/pyenv/lib/python2.7/site-packages/socketio/server.py", line 509, in _handle_eio_message
self._handle_connect(sid, pkt.namespace)
File "/www/pyenv/lib/python2.7/site-packages/socketio/server.py", line 415, in _handle_connect
self.manager.disconnect(sid, namespace)
File "/www/pyenv/lib/python2.7/site-packages/socketio/base_manager.py", line 68, in disconnect
for room_name, room in six.iteritems(self.rooms[namespace]):
KeyError: u'/xiyouws'

[pid: 4876|app: 0|req: 19/16] 127.0.0.1 () {44 vars in 891 bytes} [Wed Mar 15 12:34:42 2017] POST /socket.io/?transport=polling&b64=1&token=81ff4591a14bd21a61afbd8fdce7f230&uid=32955967&gid=118&ssid=0&sid=78c9d8c988b14c4faf0f1cd89c8283a6 => generated 2 bytes in 94 msecs (HTTP/1.1 200) 3 headers in 117 bytes (3 switches on core 496)
Traceback (most recent call last):
File "/www/pyenv/lib/python2.7/site-packages/flask/app.py", line 1994, in call
return self.wsgi_app(environ, start_response)
File "/www/pyenv/lib/python2.7/site-packages/flask_socketio/init.py", line 42, in call
start_response)
File "/www/pyenv/lib/python2.7/site-packages/engineio/middleware.py", line 47, in call
return self.engineio_app.handle_request(environ, start_response)
File "/www/pyenv/lib/python2.7/site-packages/socketio/server.py", line 353, in handle_request
return self.eio.handle_request(environ, start_response)
File "/www/pyenv/lib/python2.7/site-packages/engineio/server.py", line 298, in handle_request
start_response(r['status'], r['headers'] + cors_headers)
IOError: headers already sent
[pid: 4876|app: 0|req: 19/17] 127.0.0.1 () {38 vars in 747 bytes} [Wed Mar 15 12:34:42 2017] GET /socket.io/?transport=websocket&token=fb10ee56de95c2ecca512dd5158b4652&uid=32955967&gid=118&ssid=0&sid=0da764e5a4a54df2b8e2eb854136655f => generated 2 bytes in 639 msecs (HTTP/1.1 101) 4 headers in 181 bytes (1 switches on core 498)
Traceback (most recent call last):
File "/www/pyenv/lib/python2.7/site-packages/gevent/greenlet.py", line 536, in run
result = self._run(*self.args, **self.kwargs)
File "/www/pyenv/lib/python2.7/site-packages/engineio/async_gevent_uwsgi.py", line 53, in select_greenlet_runner
select([fd], [], [])[0]
File "/www/pyenv/lib/python2.7/site-packages/gevent/select.py", line 141, in select
sel_results = _original_select(rlist, wlist, xlist, 0)
error: (9, 'Bad file descriptor')
Wed Mar 15 12:34:42 2017 <Greenlet at 0x7f1138b26d70: select_greenlet_runner(12, <gevent.event.Event object at 0x7f11387d4e90>)> failed with error

@miguelgrinberg
Copy link
Owner

Your client appears to be passing a bad namespace /xiyouws. I need to validate on the server and prevent the crash, but I think this problem is from the client.

@miguelgrinberg miguelgrinberg self-assigned this Mar 17, 2017
KoraLinSar pushed a commit to KoraLinSar/python-socketio that referenced this issue Aug 24, 2022
principlesoftware-dev pushed a commit to principlesoftware-dev/python-socketio that referenced this issue Sep 1, 2024
francomattar added a commit to francomattar/socketio-nw-python that referenced this issue Dec 13, 2024
jamesdev9 pushed a commit to jamesdev9/socketio-python that referenced this issue Dec 22, 2024
NoBrainer242 pushed a commit to NoBrainer242/Python-socketio-web that referenced this issue Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants