The Gevent Worker Problem
Odoo uses a separate gevent-based worker for longpolling and WebSocket connections. This worker handles real-time features: live chat, Discuss messaging, push notifications, and presence detection. When it crashes or is misconfigured, these features silently stop working.
Symptoms of Gevent Worker Issues
- Live chat widget does not appear or shows "offline"
- Discuss messages do not appear in real-time (requires page refresh)
- Notifications do not pop up
- Browser console shows WebSocket connection errors
- "Bus" errors in Odoo logs
- High CPU usage from reconnection loops
What the Errors Look Like
# In Odoo logs:
ERROR odoo.service.server: gevent worker pid XXXX exited with status 1
WARNING odoo.service.server: Gevent mode requires the gevent library
# In browser console:
WebSocket connection to 'wss://your-domain.com/websocket' failed
poll error: timeout
bus service: connection lost, reconnecting...
# In nginx error log:
upstream timed out (110: Connection timed out) while reading response header
from upstream, client: x.x.x.x, upstream: "http://127.0.0.1:8072/websocket"How Gevent Workers Work in Odoo
When workers > 0 in odoo.conf, Odoo spawns:
- HTTP workers (multi-processing) on port 8069 — handle regular web requests
- Gevent worker (single, async) on port 8072 — handles longpolling/WebSocket
If workers = 0 (threaded mode), everything runs in one process and gevent is not used. This works for development but not production.
Cause 1: Gevent Not Installed
# Check if gevent is installed
python3 -c "import gevent; print(gevent.__version__)"
# If not installed:
pip3 install gevent
# For Odoo's requirements:
pip3 install gevent gevent-websocketCause 2: Workers Set to 0
With workers = 0, Odoo runs in threaded mode. The gevent worker is not spawned, and longpolling uses a fallback that does not scale.
# In odoo.conf — enable multi-processing:
workers = 4
# Gevent worker is spawned automatically when workers > 0
# It listens on the longpolling port (default 8072)
gevent_port = 8072Cause 3: Nginx Not Proxying WebSocket
The most common production issue. Nginx must proxy /websocket and /longpolling to port 8072.
# In nginx server block:
# Odoo 16+ uses WebSocket
location /websocket {
proxy_pass http://127.0.0.1:8072;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400; # 24 hours for long-lived connections
}
# Odoo 15 and earlier use longpolling
location /longpolling {
proxy_pass http://127.0.0.1:8072;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 86400;
}
# Required at the http level:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}Cause 4: Memory Limit Kills Gevent Worker
The gevent worker is subject to the same memory limits as HTTP workers. With many concurrent connections, it can exceed limits and get killed.
# In odoo.conf — increase limits for gevent:
limit_memory_hard = 2684354560 # 2.5 GB
limit_memory_soft = 2147483648 # 2 GB
# The gevent worker handles many connections in one process
# It needs more memory than a regular workerCause 5: Port 8072 Conflict
# Check if something else is using port 8072
ss -tlnp | grep 8072
# If another process is using it, change Odoo's gevent port:
# In odoo.conf:
gevent_port = 8073
# Then update nginx to proxy to the new portCause 6: Gevent Version Incompatibility
Certain gevent versions have bugs that cause crashes with specific Python versions.
# Check versions
python3 --version
python3 -c "import gevent; print(gevent.__version__)"
# Known good combinations:
# Python 3.10 + gevent 22.10+
# Python 3.11 + gevent 23.7+
# Python 3.12 + gevent 24.2+
# Upgrade gevent:
pip3 install --upgrade geventDiagnosing Gevent Issues
# 1. Check if gevent worker is running
ps aux | grep gevent
# Should show a process with 'gevent' in the command
# 2. Check if port 8072 is listening
ss -tlnp | grep 8072
# 3. Test longpolling directly
curl -v http://127.0.0.1:8072/websocket
# Should get a 426 Upgrade Required (means it is working)
# 4. Check Odoo logs for gevent errors
grep -i gevent /var/log/odoo/odoo-server.log | tail -20
# 5. Check nginx error log
tail -20 /var/log/nginx/error.log | grep -i 'upstream\|websocket'Quick Fix Checklist
- Ensure
workers > 0in odoo.conf - Ensure gevent is installed:
pip3 install gevent - Ensure nginx proxies
/websocketto port 8072 with WebSocket headers - Set
proxy_read_timeout 86400in nginx for long-lived connections - Increase memory limits if the gevent worker keeps dying
- Restart both Odoo and nginx after changes