← Back to team overview

openerp-community-reviewer team mailing list archive

Re: [Merge] lp:~cedric-lebrouster/ocb-server/ocb-7.0-bug-1322191-db_maxconn into lp:ocb-server

 

Thanks for review.

What I understand by reading the code is that this function has 4 parts.
First it removes closed or leaked connections - none of our business here
Then it tries to re-use an iddle connection previously opened for the same database
If no iddle connection is found for this database, and if db_maxconn is reached, it will free any other iddle connection, and here was the bug
Finally, it will open a new connection

So the bug needs to have several databases opened to occur.

How to test :
I check number of postgres connections on linux with the psql command:
psql -c "SELECT datid,datname,procpid,usesysid,usename,current_query FROM pg_stat_activity WHERE application_name!='psql';" postgres

Set in config file db_maxconn = 4 (must be higher than max_cron_threads if I remember correct)
Run openerp
Login to a database
You should see 3 or 4 postgres connections for your database.

Now, without loging out, login to another database (loging out would free connections)
You should now see more than 4 used databases. If not, click on a menu on the 2 databases with a low time interval. For whatever reason connections are correctly freed or their database switched sometimes, but I don't know why or where in the code.

-- 
https://code.launchpad.net/~cedric-lebrouster/ocb-server/ocb-7.0-bug-1322191-db_maxconn/+merge/220666
Your team OpenERP Community Backports is subscribed to branch lp:ocb-server.


References