OCA / queue

Asynchronous Job Queue
GNU Affero General Public License v3.0
183 stars 460 forks source link

Error with PgBouncer #539

Closed esakarya closed 1 year ago

esakarya commented 1 year ago

Here is my config [odoo] db_port = 6432

[queue_job]

pgbouncer

jobrunner_db_host = localhost jobrunner_db_port = 6432 jobrunner_db_user = xxx jobrunner_db_password = xxx

After complete some jobs, happen following error: Traceback (most recent call last): File "/opt/odoo/addons-server/queue_job/jobrunner/runner.py", line 511, in run self.process_notifications() File "/opt/odoo/addons-server/queue_job/jobrunner/runner.py", line 455, in process_notifications with db.select_jobs("uuid = %s", (uuid,)) as cr: File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__ self.gen.throw(typ, value, traceback) File "/opt/odoo/addons-server/queue_job/jobrunner/runner.py", line 325, in select_jobs with closing(self.conn.cursor("select_jobs", withhold=True)) as cr: File "/usr/lib/python3.10/contextlib.py", line 340, in __exit__ self.thing.close() psycopg2.errors.InvalidCursorName: cursor "select_jobs" does not exist

sbidoul commented 1 year ago

Not sure this is related to your error, but be aware that queue_job uses LISTEN/NOTIFY so it may require specific pgbouncer configuration.

esakarya commented 1 year ago

What your configuration offer?

guewen commented 1 year ago

Specifically, pgbouncer has to work in session pooling. It will not work with transaction pooling. I suppose you could use session pooling for the job runner 's connection and transaction pooling for the other workers.

esakarya commented 1 year ago

Yes also i see that, but then pgbouncer doesnt help postgresql memory usage.

guewen commented 1 year ago

That's why I say you could have 2 different configurations, one for the jobrunner and one for other workers, so you'd only have a small portion of connections on session mode. But really that is not an issue with queue_job but with pg_bouncer

esakarya commented 1 year ago

Any one can tell me how can i configure workers pooling? @guewen, i cant success my self. Can u tell me how can seperate job workers to session and other workers to transaction pooling?

Ohh sorry i got it, job runner will direct connect to db. Got it