Credit to @panos_xrg and @reis_pt for pointing me in the good direction https://twitter.com/panos_xrg/status/556460140149633026 https://twitter.com/reis_pt/status/556456989170339841
It seems it's the official strategy of Odoo to keep connection to postgres open, at least if what was said in this very old thread https://bugs.launchpad.net/openobject-server/+bug/463219 is still true.
I have a dozen of odoo services connected to the same postgres, each having five database to manage with 4 workers. I still can't found how many connections are opened for each services/database/workers and under which conditions but it doesn't seems to be really controled and it finally reach the 100 connections which is the limit of my postgres configuration.
In the F3 fork @panos_xrg decided to automatically close all connections older that 300seconds https://github.com/xrg/openerp-server/commit/b215015ba0453a. After playing a little with the odoo config, I found that there is a way to achieve the same thing which the official Odoo, it's the db_maxconn parameter.
When the number of opened connection in an odoo service reach the db_maxconn limit, it's seems the oldest connections are automatically closed. Looks like the way to go for me, and I guess that the rules are :
-The sum of all db_maxconn settings for each odoo services connected to the same postgres shall be less that this postgres maxconn configuration.
-The db_maxconn settings for an odoo service shall be high enough to manage the concurrent requests on this service.
So I'll try to set a db_maxconn settings to 10 on each of my odoo services, and I hope this will resolve the problem. I guess this is an important information to have in mind when you want like me to make many odoo services connected to same postgres, and not one big odoo service connected to one postgres (like Odoo SA if I'm not mistaking) nor several odoo services having each their own postgres (like most of the other odoo hosting).
Hy, I have the same problem with V7 and postgresql 9.3 and without docker on ubuntu server 14.04.1 After users deconnect from OpenERP, their postgresql process stay active : postgres 23905 1.4 1.7 256692 36996 ? Ss 10:36 0:05 postgres: openerp7 xxxxxx [local] idle postgres 24019 0.3 1.7 259516 36184 ? Ss 10:36 0:01 postgres: openerp7 xxxxxxx [local] idle postgres 24631 0.2 1.6 264400 34856 ? Ss 10:38 0:00 postgres: openerp7 xxxxxxx [local] idle postgres 24452 0.3 1.6 259576 34752 ? Ss 10:38 0:00 postgres: openerp7 xxxxxxxx [local] idle postgres 23913 0.5 1.6 259252 34424 ? Ss 10:36 0:02 postgres: openerp7 xxxxxxxx [local] idle postgres 24247 1.2 1.6 256408 34100 ? Ss 10:37 0:03 postgres: openerp7 xxxxxxxx [local] idle postgres 24534 0.2 1.5 259420 31896 ? Ss 10:38 0:00 postgres: openerp7 xxxxxxxxx [local] idle Each user (student) has his own database. Thanks Patrick