Skip to content

Commit

Permalink
[FIX] server: limit concurrent including cron thread
Browse files Browse the repository at this point in the history
When using a non parsable ODOO_MAX_HTTP_THREADS value, take into account
max_cron_threads.
When a lot of xmlrpc or jsonrpc calls are made, 2 cursor are used per
call due to the authentification so it maxes out and the pool limit.
If the cron_thread are using a cursor we end up with a "Pool Is Full"
error.

closes odoo#177258

X-original-commit: 24f67bf
Signed-off-by: Rémy Voet (ryv) <ryv@odoo.com>
  • Loading branch information
sts-odoo committed Aug 21, 2024
1 parent 2468d2e commit d2ce662
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion odoo/service/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def __init__(self, host, port, app):
# If the value can't be parsed to an integer then it's computed in an automated way to
# half the size of db_maxconn because while most requests won't borrow cursors concurrently
# there are some exceptions where some controllers might allocate two or more cursors.
self.max_http_threads = config['db_maxconn'] // 2
self.max_http_threads = max((config['db_maxconn'] - config['max_cron_threads']) // 2, 1)
self.http_threads_sem = threading.Semaphore(self.max_http_threads)
super(ThreadedWSGIServerReloadable, self).__init__(host, port, app,
handler=RequestHandler)
Expand Down

0 comments on commit d2ce662

Please sign in to comment.