Skip to content

Add tests proving queue cleanup on timeout and hard-kill#1019

Open
mPokornyETM wants to merge 5 commits intomasterfrom
test/773-timeout-queue-cleanup
Open

Add tests proving queue cleanup on timeout and hard-kill#1019
mPokornyETM wants to merge 5 commits intomasterfrom
test/773-timeout-queue-cleanup

Conversation

@mPokornyETM
Copy link
Copy Markdown
Contributor

Summary

Adds LockStepTimeoutQueueTest with 5 tests that exhaustively verify the lock queue is properly cleaned up when builds are timed out, aborted, or hard-killed while waiting for a lockable resource.

Tests

Test Scenario
imeoutWhileWaitingForLockClearsQueue timeout step wrapping lock — clean stop() path
�bortWhileWaitingForLockByLabelClearsQueue executor.interrupt() on label-based lock
imeoutMiddleBuildInQueuePreservesOrder Middle build times out, FIFO order preserved for remaining waiters
hardKillWhileWaitingForLockClearsQueueViaIsValid doKill() with multiple waiters — isValid() fallback removes stale queue entry
hardKillOnlyWaiterDoesNotBlockFutureBuilds doKill() sole waiter — future builds can still acquire the lock

Analysis of #773

The reported scenario involves a parent pipeline with a timeout that triggers downstream jobs via the build() step. When the parent times out:

  1. Direct lock() inside timeout(): works correctly. LockStepExecution.stop() calls unqueueContext() which removes the waiting entry from the queue. This is covered by the first 3 tests.

  2. Hard kill (extreme prejudice): also works correctly. Even when stop() is bypassed, the isValid() check in getNextQueuedContext() detects that the killed build is no longer running and removes the stale queue entry when another resource is freed. This is covered by the last 2 tests.

  3. Cross-build propagation (the actual Resources are not removed from queue, when timeout is reached #773 scenario): when a parent pipeline times out and kills the build() step, the downstream build may continue running independently because build cancellation propagation is handled by the pipeline-build-step plugin, not lockable-resources. The downstream build's lock queue entry is valid (the build IS still running), so lockable-resources correctly keeps it queued.

Conclusion

The lockable-resources plugin correctly handles all timeout/abort/kill scenarios for its own queue. The issue described in #773 is a cross-plugin concern where pipeline-build-step does not propagate the parent's timeout cancellation to the downstream build.

Fixes #773

Adds LockStepTimeoutQueueTest with 5 tests that verify the lock queue
is properly cleaned up when builds are timed out, aborted, or
hard-killed while waiting for a lockable resource:

- timeoutWhileWaitingForLockClearsQueue: timeout step wrapping lock
- abortWhileWaitingForLockByLabelClearsQueue: executor.interrupt()
- timeoutMiddleBuildInQueuePreservesOrder: FIFO order preserved
- hardKillWhileWaitingForLockClearsQueueViaIsValid: doKill() with
  multiple waiters — isValid() fallback removes stale queue entry
- hardKillOnlyWaiterDoesNotBlockFutureBuilds: doKill() sole waiter

All tests pass, confirming the lockable-resources plugin correctly
handles both the clean stop() path and the isValid() fallback path.

Fixes #773
@mPokornyETM mPokornyETM force-pushed the test/773-timeout-queue-cleanup branch from 0a0afcb to 2b916aa Compare April 20, 2026 21:21
@github-actions
Copy link
Copy Markdown
Contributor

⏸️ Auto-merge countdown PAUSED: CI checks are not passing. The countdown will resume when all checks are green.

@mPokornyETM mPokornyETM force-pushed the test/773-timeout-queue-cleanup branch from 2b916aa to 5381608 Compare April 21, 2026 19:35
Adds LockStepTimeoutQueueTest with 5 tests that verify the lock queue
is properly cleaned up when builds are timed out, aborted, or
hard-killed while waiting for a lockable resource:

- timeoutWhileWaitingForLockClearsQueue: timeout step wrapping lock
- abortWhileWaitingForLockByLabelClearsQueue: executor.interrupt()
- timeoutMiddleBuildInQueuePreservesOrder: FIFO order preserved
- hardKillWhileWaitingForLockClearsQueueViaIsValid: doKill() with
  multiple waiters — isValid() fallback removes stale queue entry
- hardKillOnlyWaiterDoesNotBlockFutureBuilds: doKill() sole waiter

All tests pass, confirming the lockable-resources plugin correctly
handles both the clean stop() path and the isValid() fallback path.

Fixes #773
@mPokornyETM mPokornyETM force-pushed the test/773-timeout-queue-cleanup branch from 5381608 to 37cfc7a Compare April 22, 2026 10:01
@github-actions github-actions Bot added merge-in-2-days-without-review Auto-approve countdown and removed merge-in-3-days-without-review Auto-approve countdown labels Apr 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Auto-merge countdown: This PR will be auto-approved in 2 day(s) if no review is submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resources are not removed from queue, when timeout is reached

1 participant