StackStorm / StackStorm/st2

Race condition when recovering delayed action executions (executions get stuck in "delayed" status)

Open
#3,041 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug complexity:medium enhancement
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

Today I noticed a race condition with re-scheduleing of delayed action executions on the build server (delayed -> requested).

The problem appears to be that live action and corresponding action execution database objects are not updated atomically together (aka as part of a transaction). Because of that, if for some reason process is interrupted and only live action is updated, but not the corresponding action execution is not, those executions will get stuck in the limbo and won't proceed with execution (live actions will have a status of requested and action executions will have a status of delayed).

The only way to get out of those limbos and those executions in-stuck is to cancel and re-run them (this will of course only work if those actions are idempotent).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by locating the delayed-action recovery and rescheduling flow, then trace how live actions and action executions are persisted; done means interrupted recovery cannot leave them with mismatched statuses, with a regression test covering the failure case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.