Issue 11401

Refresh pool can break any code at any time
Nosy list
ced, yangoon
Assigned to

Created on 2022-04-11.19:00:31 by ced, last changed 1 week ago by ced.


Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-11-22.11:59:42

Maybe a better solution would probably that we store in a thread local the singleton instance of the Pool at the beginning of a request. The Pool instance must become immutable and so when a Pool instance must be refreshed, it is a new Pool instance that is created and that will replace the existing Pool as global singleton. This way the other threads that have already been started, keep using the former pool until they end.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-04-11.19:00:31

As shown in issue11400, the pool can be refresh at any time since rev 32cd371b3e9c and so code using pool instance can also in many cases:

  • The pool instance has no more objects, this can be solved by storing the _pool on the instance
  • The pool singleton for a database can be stopped (not initialized) at any time. I see at least two possible solutions:
    • Keep the previous pool instance and use it as fallback if the current one is not initialized
    • Raise a specific exception so the dispatcher, cron or worker can retry it with a initialized pool.
Date User Action Args
2022-11-22 11:59:42cedsetmessages: + msg80128
2022-04-11 20:33:32yangoonsetnosy: + yangoon
2022-04-11 19:00:31cedcreate

Showing 10 items. Show all history (warning: this could be VERY long)