Render was defaulting to gthread worker instead of gevent, causing WebSocket failures:
RuntimeError: The gevent-websocket server is not configured appropriately
gunicorn -w 2 -k gthread # ❌ Wrong worker type
Updated from:
web: gunicorn -w 2 -k gevent --worker-connections 1000 --timeout 60 main:app
To:
web: python -m gevent.monkey --patch-all && gunicorn --worker-class gevent --workers 2 --worker-connections 1000 --timeout 120 --bind 0.0.0.0:$PORT --preload --max-requests 1000 --max-requests-jitter 100 main:app
Added missing gevent dependency:
gevent==24.2.1
gevent-websocket==0.10.1
- Added gevent monkey patching at the very start
- Enhanced SocketIO configuration with explicit logging and timeout settings
Created .env.example with gevent-specific configuration variables.
- Commit these changes
- Push to GitHub
- Render will automatically detect the new Procfile and requirements
- The explicit worker-class specification should force gevent usage
After deployment, check logs for:
gunicorn --worker-class gevent(not gthread)- No "gevent-websocket server is not configured" errors
- SocketIO connections working properly