Skip to content

Fix distributed bookmark queue resume race#7419

Draft
sfmskywalker with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-workflow-resumption-issue
Draft

Fix distributed bookmark queue resume race#7419
sfmskywalker with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-workflow-resumption-issue

Conversation

Copilot AI commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Purpose

Prevent parent workflows from remaining suspended after completed child workflows in distributed runtimes.


Scope

Select one primary concern:

  • Bug fix (behavior change)
  • Refactor (no behavior change)
  • Documentation update
  • Formatting / code cleanup
  • Dependency / build update
  • New feature

If this PR includes multiple unrelated concerns, please split it before requesting review.


Description

Problem

DispatchWorkflow(WaitForCompletion = true) can lose the bookmark queue wake-up in multi-node deployments when the signaled node cannot acquire the distributed queue lock. With the previous 1-minute default purge TTL, the queued resume item could be deleted before the next retry sweep.

Solution

  • Retry on lock miss

    • DistributedBookmarkQueueWorker now re-signals after a short delay when the distributed lock is unavailable.
    • This keeps queued bookmark items eligible for processing instead of relying only on the next periodic trigger.
  • Safer purge window

    • Default bookmark queue purge TTL increased from 1 minute to 1 hour.
  • Regression coverage

    • Added unit coverage for lock-miss re-signaling.
    • Added unit coverage for the default purge TTL.
if (handle == null)
{
    Logger.LogDebug("Could not acquire lock for distributed bookmark queue worker...");
    await Task.Delay(RetryDelay, cancellationToken);
    await Signaler.TriggerAsync(cancellationToken);
    return;
}

Verification

Reviewers can verify the behavior through the added unit tests and by inspecting the distributed worker lock-miss path.

Steps:

  1. Run Elsa.Workflows.Runtime.UnitTests.
  2. Review DistributedBookmarkQueueWorkerTests.
  3. Review BookmarkQueuePurgeOptionsTests.

Expected outcome:

Queued bookmark resume items are retried after distributed lock contention and are not purged before normal retry windows.


Screenshots / Recordings (if applicable)

N/A


Commit Convention

We recommend using conventional commit prefixes:

  • fix: – Bug fixes (behavior change)
  • feat: – New features
  • refactor: – Code changes without behavior change
  • docs: – Documentation updates
  • chore: – Maintenance, tooling, or dependency updates
  • test: – Test additions or modifications

Clear commit messages make reviews easier and history more meaningful.


Checklist

  • The PR is focused on a single concern
  • Commit messages follow the recommended convention
  • Tests added or updated (if applicable)
  • Documentation updated (if applicable)
  • No unrelated cleanup included
  • All tests pass

Copilot AI and others added 2 commits April 25, 2026 12:42
Agent-Logs-Url: https://github.com/elsa-workflows/elsa-core/sessions/a518907b-9fca-460b-a81c-fff600642fa2

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Agent-Logs-Url: https://github.com/elsa-workflows/elsa-core/sessions/a518907b-9fca-460b-a81c-fff600642fa2

Co-authored-by: sfmskywalker <938393+sfmskywalker@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with parent workflow not resuming after child finishes Fix distributed bookmark queue resume race Apr 25, 2026
Copilot AI requested a review from sfmskywalker April 25, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflows sometimes don't resume after child/sub-workflows finish in distributed environment.

2 participants