Project

General

Profile

Actions

Bug #22838

closed

Double-initialization of dynflow in core and foreman-tasks causes race-condition with ActiveRecord database connection

Added by Ivan Necas about 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Foreman plugin
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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

Actions #1

Updated by Ivan Necas about 6 years ago

  • Status changed from New to Assigned
  • Assignee set to Ivan Necas
  • Target version set to 252
Actions #2

Updated by The Foreman Bot about 6 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman-tasks/pull/317 added
Actions #3

Updated by Ivan Necas about 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF