dockerodoolong-pollingbus

Odoo Bus.bus unavailable


I get regularly following error message while running odoo v14 locally in docker:

odoo-14.0-stage    | 2021-04-26 10:51:00,476 10 ERROR update odoo.http: Exception during JSON request handling. 
odoo-14.0-stage    | Traceback (most recent call last):
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
odoo-14.0-stage    |     result = request.dispatch()
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 683, in dispatch
odoo-14.0-stage    |     result = self._call_function(**self.params)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 359, in _call_function
odoo-14.0-stage    |     return checked_call(self.db, *args, **kwargs)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/service/model.py", line 94, in wrapper
odoo-14.0-stage    |     return f(dbname, *args, **kwargs)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 347, in checked_call
odoo-14.0-stage    |     result = self.endpoint(*a, **kw)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 912, in __call__
odoo-14.0-stage    |     return self.method(*args, **kw)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 531, in response_wrap
odoo-14.0-stage    |     response = f(*args, **kw)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/addons/bus/controllers/main.py", line 35, in poll
odoo-14.0-stage    |     raise Exception("bus.Bus unavailable")
odoo-14.0-stage    | Exception
odoo-14.0-stage    | 
odoo-14.0-stage    | The above exception was the direct cause of the following exception:
odoo-14.0-stage    | 
odoo-14.0-stage    | Traceback (most recent call last):
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 639, in _handle_exception
odoo-14.0-stage    |     return super(JsonRequest, self)._handle_exception(exception)
odoo-14.0-stage    |   File "/home/odoo/addons/odoo/odoo/http.py", line 315, in _handle_exception
odoo-14.0-stage    |     raise exception.with_traceback(None) from new_cause
odoo-14.0-stage    | Exception: bus.Bus unavailable

My odoo.conf file:

[options]

# Service Settings
addons_path = /home/odoo/addons/odoo/addons,/home/odoo/addons/extra,/home/odoo/custom/custom_addons,/home/odoo/custom/edited_addons,/home/odoo/custom/paysy_addons
data_dir = /var/lib/odoo

# Database
db_host = postgres-12.2
db_user = odoo_13_0_stage
db_password = password

# Tuning Options
workers = 2
max_cron_threads = 1
limit_time_cpu = 600
limit_time_real = 1200
osv_memory_age_limit = 1.0
osv_memory_count_limit = False

# Network / Ports
xmlrpc_port = 8069
netrpc_port = 8070
xmlrpcs_port = 8071
longpolling_port = 8072
proxy_mode = True

I think it hast something to do with longpolling but aren't sure. As you can see I already set the proxy_mode true, configured the longpolling port and set the 2 workers. I also tried to configure zero or more than two workers as suggested elsewhere.

Hopefully someone can help.

PS: Following my docker-compose file:

version: "3.9"
services:

    odoo-14.0-stage:
        container_name: odoo-14.0-stage
        image: odoo-14.0:stage
        build: ./volumes/
        ports:
            - 13001:8069/tcp
            - 8070:8070
            - 8071:8071
            - 8072:8072
        depends_on:
            - postgres-12.2
        volumes:
            - ./config:/etc/odoo:ro
            - ./volumes:/home/odoo/addons
            - ./addons:/home/odoo/custom
            - ./data:/var/lib/odoo
        restart: always

    postgres-12.2:
        container_name: postgres-12.2
        image: postgres:12.2
        build: ./postgres/12.2/
        volumes:
            - ./postgres/12.2/volumes/data:/var/lib/postgresql/data:delegated
        restart: always

Solution

  • Those logs are a cryptic way Odoo tells you that you need to configure your proxy correctly.

    Odoo normal operations are done through the main (also called HTTP) port, which defaults to 8069. However, long polling requests are a bit different:

    Your browser knows nothing about how Odoo is configured. It just makes all requests through the same port, whatever it is (tip: HTTP uses 80 by default, and HTTPS uses 443).

    That's why, if you are using Odoo in multiprocess mode, there must be an inverse proxy sitting between the web browser and Odoo, directing requests to the right port depending on the path.

    Odoo docs give an example nginx configuration and more details. Check them out: https://www.odoo.com/documentation/14.0/administration/install/deploy.html#id7