Bug #22838
closedDouble-initialization of dynflow in core and foreman-tasks causes race-condition with ActiveRecord database connection
Description
During the initialization process, we ensure the size of the db pool is sufficient for the executors.
However, we run this twice (once from foreman, second from foreman-tasks). What can happen is:
1. the foreman initializes the world, as part of initialization, there are already some tasks being triggered
2. in the meantime, the foreman-tasks initialization runs as well (https://github.com/theforeman/foreman-tasks/blob/7434c95681f56f2295c82d46ad4a9590fb4763ff/lib/foreman_tasks/engine.rb#L149), and part of the initialization is re-connection of the ActiveRecord::Connection https://github.com/Dynflow/dynflow/blob/cc7c854c5d4c7ee5db883d9f8e285c9db573d83b/lib/dynflow/rails/configuration.rb#L93
3. during the short time, between disconnecting and connecting, there can be something in the tasks running, that requires the active record connection
4. it leads to "No connection pool with 'primary' found" error
Updated by Ivan Necas about 7 years ago
- Status changed from New to Assigned
- Assignee set to Ivan Necas
- Target version set to 252
Updated by The Foreman Bot about 7 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman-tasks/pull/317 added
Updated by Ivan Necas about 7 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset ac2174659ae0c86771eb454920033afcf938e2de.