Port Already in Use Error in Odoo
When starting Odoo, you encounter:
OSError: [Errno 98] Address already in use
ERROR: Address already in use
Port 8069 is in use by another program.
# Or for the longpolling port:
OSError: [Errno 98] Address already in use: ('0.0.0.0', 8072)This error means another process is already listening on the port Odoo wants to use. The two main Odoo ports are 8069 (HTTP) and 8072 (longpolling/websocket).
Step 1: Find What Is Using the Port
# Check what's on port 8069
sudo lsof -i :8069
sudo ss -tlnp | grep 8069
# Check port 8072 (longpolling)
sudo lsof -i :8072
sudo ss -tlnp | grep 8072
# More detailed — show PID and process name
sudo fuser -v 8069/tcpCommon results:
- Another Odoo process — previous instance did not shut down cleanly
- Apache/Nginx — reverse proxy is listening on the same port
- Another application — a different service is using port 8069
Fix 1: Kill the Stale Odoo Process
If a previous Odoo instance is still running:
# Find all Odoo processes
ps aux | grep odoo-bin
# Kill them gracefully
sudo systemctl stop odoo
# If systemctl does not work (process not managed by systemd)
sudo kill $(sudo lsof -t -i :8069)
# Force kill if graceful stop fails
sudo kill -9 $(sudo lsof -t -i :8069)
# Start Odoo again
sudo systemctl start odooFix 2: Change Odoo's Port
If another service legitimately needs port 8069, change Odoo's port in the configuration:
# Edit odoo.conf
[options]
http_port = 8080
longpolling_port = 8082
# Or via command line
./odoo-bin --http-port=8080 --longpolling-port=8082Remember to update your reverse proxy configuration if you change ports:
# Nginx example
upstream odoo {
server 127.0.0.1:8080;
}
upstream odoochat {
server 127.0.0.1:8082;
}Fix 3: Multiple Odoo Instances on Same Server
Running multiple Odoo instances requires unique ports for each:
# Instance 1: odoo1.conf
http_port = 8069
longpolling_port = 8072
xmlrpc_port = 8069
# Instance 2: odoo2.conf
http_port = 8070
longpolling_port = 8073
xmlrpc_port = 8070Fix 4: Docker Port Conflicts
In Docker, port conflicts happen at the host mapping level:
# Error:
Bind for 0.0.0.0:8069 failed: port is already allocated
# Check Docker containers using the port
docker ps | grep 8069
# Stop the conflicting container
docker stop container_name
# Or map to a different host port in docker-compose.yml
ports:
- "8080:8069" # Host 8080 -> Container 8069
- "8082:8072" # Host 8082 -> Container 8072Fix 5: Bind to Specific Interface
If the port conflict is only on a specific network interface:
# Bind only to localhost (common for behind reverse proxy)
[options]
http_interface = 127.0.0.1
# Or bind to a specific IP
http_interface = 192.168.1.100Preventing Stale Processes
Odoo processes sometimes survive a crash and hold the port. Add a PID file to detect this:
# In odoo.conf
pidfile = /var/run/odoo/odoo.pid
# Create the PID directory
sudo mkdir -p /var/run/odoo
sudo chown odoo:odoo /var/run/odoo
# In systemd service, add:
[Service]
PIDFile=/var/run/odoo/odoo.pid
ExecStartPre=/bin/bash -c 'kill $(cat /var/run/odoo/odoo.pid 2>/dev/null) 2>/dev/null; true'Quick Reference
| Port | Purpose | Config Key |
|---|---|---|
| 8069 | HTTP/Web interface | http_port |
| 8072 | Longpolling/Websocket | longpolling_port |
| 8071 | Gevent (Odoo 17+) | gevent_port |
Prevention
DeployMonkey allocates unique ports per instance and manages process lifecycle automatically. The AI agent detects port conflicts before they cause startup failures and handles graceful shutdown of all Odoo processes.