← Back to team overview

credativ team mailing list archive

[Bug 954907] Re: Changing company does not work properly with gunicorn

 

> I have reproduce the same thing at my end, but it's hard to reproduce
because I didn't face the problem all time.

The reason that you don't face the same problem every time is because it
depends which gunicorn worker process is used for each call.

For example, if you have 4 gunicorn workers and a database with 2
companies (Company A and B). Say that you login to 'Company A', and the
initial login request goes through worker 1. As you continue to navigate
OpenERP, requests will go through any of the workers (1-4), and they
will all think that you are logged into 'Company A'... which is correct.

Then, if you switch to "Company B" in Preferences, then that request
will get sent through a worker (let's say worker 2). So now, worker 2
knows that you are in 'Company B', but actually workers 1, 3 and 4 think
you are in 'Company A'. So if you request a company-specific document,
then it depends which worker processes the request whether you will see
the document of not. So, if the request goes through worker 2, you're
lucky and can see the document. However, if request is sent through
worker 1, 3 or 4, then you will get an error (the "Deleted document
error) as those workers think that you are logged into "Company A".

The problem is that OpenERP is not stateless when it comes to changing
company.

-- 
You received this bug notification because you are a member of credativ,
which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/954907

Title:
  Changing company does not work properly with gunicorn

Status in OpenERP Server:
  Confirmed

Bug description:
  When OpenERP is running with multiple gunicorn workers, changing
  company after login does not work correctly.

  To see the issue, create a database with multiple companies and have
  rules that limit the view of a set of records e.g. account.account,
  based on the company that you are logged into. You need your user Then
  start OpenERP with multiple gunicorn workers.

  1. Once logged in, change company (in the Preferences dialog).
  2. Go to a list of records that give a limited view based on the ir.rule e.g. account.account.
  3. Keep refreshing the  list by clicking the menu link that displays the record list.

  Expected result:
  Should only see the accounts for the company that you are logged into - every time that you click on the menu link.

  Actual result:
  Sometimes you see the accounts that you are logged into, other times you see the accounts from the previous company that you were logged into. Presumably, this is because you have only changed company in one of the gunicorn workers... not all of them. So OpenERP does not seem to be completely stateless when it comes to changing company.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-server/+bug/954907/+subscriptions