odoo worker 异常Exception(“bus.Bus unavailable”)

odoo worker 异常Exception(“bus.Bus unavailable”)

odoo 在配置workers后会有如下错误

Traceback (most recent call last):

File “/opt/odoo/openerp/http.py”, line 530, in _handle_exception

return super(JsonRequest, self)._handle_exception(exception)

File “/opt/odoo/openerp/http.py”, line 567, in dispatch

result = self._call_function(**self.params)

File “/opt/odoo/openerp/http.py”, line 303, in _call_function

return checked_call(self.db, *args, **kwargs)

File “/opt/odoo/openerp/service/model.py”, line 113, in wrapper

return f(dbname, *args, **kwargs)

File “/opt/odoo/openerp/http.py”, line 300, in checked_call

return self.endpoint(*a, **kw)

File “/opt/odoo/openerp/http.py”, line 796, in __call__

return self.method(*args, **kw)

File “/opt/odoo/openerp/http.py”, line 396, in response_wrap

response = f(*args, **kw)

File “/opt/odoo/addons/bus/bus.py”, line 188, in poll

raise Exception(“bus.Bus unavailable”)

原因:

工人> 0会有很多线程在端口8069上。

你也会有几个cron线程8069(max-cron-threads)。

一个gevent线程在端口8072上(longpolling-port)。

这里的问题就在8072上,web会用8069请求longpolling。所以http出错。

解决方法:

安装返向代理,用http://host:80代理 http://localhost:8069/ 和 http://localhost:8072/longpolling即可

如nginx配置

Conf代码 收藏代码
location / {
proxy_pass http://localhost:8069/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /longpolling/ {
proxy_pass http://localhost:8072/longpolling/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}