Technical メーリングリストのアーカイブ

technical@mail.odoo.com

アバター

Re: [Odoo11] Improve performance by configuration worker > 0 casuse Exception bus.Bus unavailable

by
Dynamic IT Solutions Co., Ltd., APISAK SRIHAMAT
- 2018年08月29日 04時48分03秒
Dear Odooist,

Many thanks,

Your decription rings a bell, I think the only reason exception happened is our nginx reverse proxy /longpolling to port 8072 is not working.

Because if it's working the module IM bus @route /longpolling should not been executed thought x.x.x.x:8069/longpolling. (I guess this is may be old code that never been clean up.)
Instead it should go to 8072, which newer code path in ../service/server.py -> class GeventServer.

We experiment slowly to ensure port 80, 8069, 8072 is not already been used. Then it's simply working without an exception.


Dear  Technical Team,

I just want to share to you who might face same problem with me.

Our experimental nginx configuration is simple as:
upstream backend-odoo {
  server x.x.x.x:8069;
}
server {
  location /longpolling {
    proxy_pass http://x.x.x.x:8072;
  }
  location / {
    proxy_pass http://backend-odoo;
  }

Our exceprimantal odoo configuration is simple as odoorc:
workers = 5

I hope it saved you guy some valuable time.

Regards,
Apisak Srihamat



On Wed, Aug 29, 2018 at 9:12 AM, apisak Srihamat <apisak.srihamat@octcorp.site> wrote:
Dear Odooist,

Interesting, let me try to clearify your suggestion and correct me if I'm wrong.

The traffic to '/' should redirect to 8069.
And traffic to '/longpolling' should redirect to 8072.

Then when you mentioned:
> So do not visit Odoo using http://odoo_addres:8069/, instead proxy it with nginx where as described here https://www.odoo.com/documentation/11.0/setup/deploy.html#livechat
What does 'it' mean ? Is that '/' ?
Where should we redirect '/' to ?
Do you mind to shrare your experiment of odoo execution command and configuration (nginx and odoo) that make workers > 0 works in prefork mode ? (with IM bus module installed)


Please note that we already modified nginx to reverse proxy /longpolling to port 8027 for longpolling request as explained in:

Regards,
Apisak Srihamat


On Tue, Aug 28, 2018 at 5:43 PM, O Dooist <odooist@gmail.com> wrote:
> I suspected that you are not installed module(s) that required Live chat or IM bus cause you never see errors exception mentioned.
LOL :-)
This error is caused because Odoo UI chat module is calling /longpolling/poll and it's served by a worker instance not gevent one.
So do not visit Odoo using http://odoo_addres:8069/, instead proxy it with nginx where as described here https://www.odoo.com/documentation/11.0/setup/deploy.html#livechat

Regards,


пн, 27 авг. 2018 г. в 10:06, apisak Srihamat <apisak.srihamat@octcorp.site>:
Dear Technical Team,

FYI:

According to Odoo support team, I was informed that deployment method is important to make it work.

Basically, I was told that prcess-based preforking is not working when enabled Live chat. We need to either deploy in thread mode or gevent mode.
As my experiment, IM bus is required by Live chat (And many modules such as web, sales and crm etc. Those modules are referring to IM bus).
Once we enabled workers > 0 then run in prefork mode then it's expected exception error by Odoo itself.

Dear Can Tecim,

Since you executed in prefork mode, I suspected that you are not installed module(s) that required Live chat or IM bus cause you never see errors exception mentioned.
Please let me know if my suspectation is correct.

Regards,
Apisak Srihamat


On Wed, Aug 15, 2018 at 12:05 AM, apisak Srihamat <apisak.srihamat@octcorp.site> wrote:
Dear Can Tecim,

Many thanks, your suggestion saved my day and night.

As debuged, there is only one @route for '/longpolling/poll' which get called when we changed workers > 0. It's in Module IM Bus in Class BusController method poll. Which will raise particular Exception when dispatch not get set. 

I thought it must only get set in Module IM Bus in Model's bus.py since you confirmed you don't have this problem then it allowed me to think that it can be set some where else.

We have to look into the reason why we don't have object dispatch then.

Regards,
Apisak Srihamat


On Tue, Aug 14, 2018, 15:44 Can Tecim <cant@projetgrup.com> wrote:

In multiprocessing mode (worker > 0), it will automatically spawn a process with 'gevent' attribute to handle longpolling, I don't have this issue.


If you dig into source code, you'll se what I mean, look at long_polling_spawn method in odoo/service/server.py
see also: run method of PreforkServer class

Best Regards,,
Can Tecim, CTO
Projet Grup

apisak Srihamat <apisak.srihamat@octcorp.site> şunları yazdı (14 Ağu 2018 10:23):

Dear Technical Team,

We are exploring performance improvement method by changed odoo configuration worker > 0 then we found an error Exception("bus.Bus unavailable").

By dig into details in module "IM bus", we realized that object "dispatch" (ImDispatch) only created when running in gevent mode (not prefork mode which workers > 0)
In my understanding, I think who configured workers > 0 and run prefork mode will face this error, is that correct ?
What do you guy do to avoid this exception error ?
Or you guy found this exception error but ignored ?


Please note that we already modified nginx to reverse proxy /longpolling to port 8027 for longpolling request as explained in:
The request arrived to @route poll in controller of module "IM bus" but raise an exception as mentioned. Without looking closely in log file you may not see it.

The reason I asked is, I think we need to either:
1. Modify/add handler of longpolling in prefork mode. (If required) 2. Remove longpolling in prefork mode. (If not required)
Before doing some of those, I curious how technical team handle this exception after config workers > 0.

Regards,
Apisak Srihamat

_______________________________________________
Mailing-List: https://www.odoo.com/groups/technical-62
Post to: mailto:technical@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/technical-62
Post to: mailto:technical@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/technical-62
Post to: mailto:technical@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/technical-62
Post to: mailto:technical@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe



参照