gevent-socketio
gevent-socketio copied to clipboard
Server not able to get address raising no attribute 'cfg_addr'
My setup:
Gunicorn + gevent_socketio + django
Started the server by:
gunicorn --env DJANGO_SETTINGS_MODULE=linbang.settings -c gunicorn_config.py --error-logfile - linbang.wsgi:application
In gunicorn_config.py:
bind = '0.0.0.0:8000'
max_requests = 10000
worker_class = 'socketio.sgunicorn.GeventSocketIOWorker'
workers = 5
def post_fork(server, worker): import pymysql pymysql.install_as_MySQLdb()
[2014-08-29 11:19:13 +0800] [79204] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/Users/lishuo/envs/linbang/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
worker.init_process()
File "/Users/lishuo/envs/linbang/lib/python2.7/site-packages/gunicorn/workers/ggevent.py", line 193, in init_process
super(GeventWorker, self).init_process()
File "/Users/lishuo/envs/linbang/lib/python2.7/site-packages/gunicorn/workers/base.py", line 120, in init_process
self.run()
File "/Users/lishuo/envs/linbang/lib/python2.7/site-packages/socketio/sgunicorn.py", line 80, in run
**ssl_args
File "/Users/lishuo/envs/linbang/lib/python2.7/site-packages/socketio/server.py", line 72, in __init__
address = args[0].cfg_addr[0]
AttributeError: 'socket' object has no attribute 'cfg_addr'
Traceback (most recent call last):
File "/Users/lishuo/envs/linbang/lib/python2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
worker.init_process()
File "/Users/lishuo/envs/linbang/lib/python2.7/site-packages/gunicorn/workers/ggevent.py", line 193, in init_process
super(GeventWorker, self).init_process()
File "/Users/lishuo/envs/linbang/lib/python2.7/site-packages/gunicorn/workers/base.py", line 120, in init_process
self.run()
File "/Users/lishuo/envs/linbang/lib/python2.7/site-packages/socketio/sgunicorn.py", line 80, in run
**ssl_args
File "/Users/lishuo/envs/linbang/lib/python2.7/site-packages/socketio/server.py", line 72, in __init__
address = args[0].cfg_addr[0]
AttributeError: 'socket' object has no attribute 'cfg_addr'
I'm having the same issue when stress testing simple test app.
AttributeError: 'socket' object has no attribute 'cfg_addr'
@shuoli84 I see that you use workers = 5 in your config file. Does it work without problems ? I was having errors when workers was set to > 1, despite the fact that I was using websocket transport (so this wasn't issue of long-polling and different processes for each request).
I am having the same issue.
Save the following snippet as geventworker.py
from socketio.sgunicorn import GeventSocketIOWorker
class MyGeventSocketIOWorker(GeventSocketIOWorker):
policy_server = False
and launch your app with
gunicorn --worker-class geventworker.MyGeventSocketIOWorker wsgy:app
as noted here, using earlier gunicorn versions may work for you.
pip uninstall gunicorn pip install gunicorn==18.0
I just committed a fix, which will make it work with newer version of gunicorn. The merge is pending. ant9000 workaround will help but better solution is to adapt to gunicorn changes.
Merge will stay pending forever as this project is missing a maintainer.
BTW, I can confirm that the workaround of @ant9000 works fine. Alternatively, you can also set the environment variable POLICY_SERVER
to false.
Cool. I will stay with my forked branch then :)