Skip to content

inquiry race condition fix; default max concurrency, db max delay - #6399

Open
guzzijones wants to merge 14 commits into
masterfrom
race_condition_fix_upstream
Open

inquiry race condition fix; default max concurrency, db max delay#6399
guzzijones wants to merge 14 commits into
masterfrom
race_condition_fix_upstream

Conversation

@guzzijones

@guzzijones guzzijones commented Aug 26, 2026

Copy link
Copy Markdown
Contributor
  1. Fix a race condition with inquiries.
    • lock coordinator in workflow engine and action execution engine to prevent race with inquiry resuming.
  2. Add a default concurrency for workflows.
    • if set to 0 then no concurrency is the default .
    • default config value is 0 to keep current behavior
    • if workflow sets a concurrency it overrides this
  3. Added stop max delay
    • stop_max_delay=cfg.CONF.workflow_engine.retry_stop_max_msec
      (60 s default) added to every retry_on_transient_db_errors
      decorator in st2common.services.workflows — 10 call sites
      including request, request_pause, request_resume,
      request_cancellation, update_task_state,
      update_task_execution, resume_task_execution,
      update_workflow_execution, resume_workflow_execution,
      fail_workflow_execution. When the ceiling is hit, the last
      StackStormDBObjectWriteConflictError propagates out to
      WorkflowExecutionHandler.process, which routes it to
      fail_workflow_execution and releases the coordination lock —
      freeing every other message waiting behind that workflow.

Back story

We had an unbounded with items that filled up the work queues. The actions were continuously rescheduled due to the process that looks back 1 minute for zombie actions. Fix 3 is more of a fail safe for mongo writes. It came about when reviewing this. Fix 1 was noticed when reviewing logs that every inquiry causes a db write conflict. Fix 2 actually bounds unbounded with items as an option.

per-workflow coord lock on the resume paths and on
handle_workflow_execution, RESUMING self-transition
in request_next_tasks, wall-clock deadline on request_next_tasks,
stop_max_delay on all retry_on_transient_db_errors decorators, and
widened retry_on_connection_errors to cover pymongo.ConnectionFailure.
@pull-request-size pull-request-size Bot added the size/L PR that changes 100-499 lines. Requires some effort to review. label Aug 26, 2026
@guzzijones guzzijones changed the title Race condition fix upstream inquiry race condition fix Aug 26, 2026
@guzzijones
guzzijones marked this pull request as draft August 27, 2026 11:27
@guzzijones guzzijones changed the title inquiry race condition fix Draft: inquiry race condition fix Aug 27, 2026
@guzzijones guzzijones changed the title Draft: inquiry race condition fix Draft: inquiry race condition fix; default max concurrency Aug 27, 2026
@guzzijones guzzijones added this to the 3.10.0 milestone Aug 27, 2026
@guzzijones guzzijones changed the title Draft: inquiry race condition fix; default max concurrency Draft: inquiry race condition fix; default max concurrency, db max delay Aug 27, 2026
@guzzijones
guzzijones requested review from nzlosh and skiedude August 27, 2026 22:18
@guzzijones
guzzijones marked this pull request as ready for review August 27, 2026 22:18
@guzzijones guzzijones changed the title Draft: inquiry race condition fix; default max concurrency, db max delay inquiry race condition fix; default max concurrency, db max delay Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L PR that changes 100-499 lines. Requires some effort to review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant