Fix "forbid" concurrency check to survive node restarts #1870
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
When a node crashes and restarts, jobs with
concurrency: "forbid"incorrectly allow concurrent execution. The issue occurs because the forbid check relies on an in-memoryactiveExecutionsmap that is cleared on restart, missing jobs still running on other nodes.Changes:
GetRunningExecutions()method to query persistent storage for executions withStartedAtbut noFinishedAtisRunnable()to check persistent storage first, then fall back to in-memory stateThe fix uses BuntDB (already persisted) as the source of truth for running executions, making the forbid check resilient to node failures and restarts.
Types of changes
What types of changes does your code introduce?
Put an
xin the boxes that applyWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
127.0.0.10/tmp/go-build2632617950/b001/dkron.test /tmp/go-build2632617950/b001/dkron.test -test.testlogfile=/tmp/go-build2632617950/b001/testlog.txt -test.paniconexit0 -test.v=true -test.timeout=3m0s HcS8Y-jUi .cfg ux_amd64/vet -p g/protobuf/ptype-test.testlogfile=/tmp/go-build1927090654/b001/testlog.txt -lang=go1.23 ux_amd64/vet -o om/cenkalti/back-test.run=TestStore_GetRunningExecutions om/cenkalti/backoff/v5@v5.0.3/er-ifaceassert ux_amd64/vet points.go /tools/clientcmd-V=full -lang=go1.21 ux_amd64/vet(packet block)127.0.0.11/tmp/go-build2632617950/b001/dkron.test /tmp/go-build2632617950/b001/dkron.test -test.testlogfile=/tmp/go-build2632617950/b001/testlog.txt -test.paniconexit0 -test.v=true -test.timeout=3m0s HcS8Y-jUi .cfg ux_amd64/vet -p g/protobuf/ptype-test.testlogfile=/tmp/go-build1927090654/b001/testlog.txt -lang=go1.23 ux_amd64/vet -o om/cenkalti/back-test.run=TestStore_GetRunningExecutions om/cenkalti/backoff/v5@v5.0.3/er-ifaceassert ux_amd64/vet points.go /tools/clientcmd-V=full -lang=go1.21 ux_amd64/vet(packet block)127.0.0.13/tmp/go-build2632617950/b001/dkron.test /tmp/go-build2632617950/b001/dkron.test -test.testlogfile=/tmp/go-build2632617950/b001/testlog.txt -test.paniconexit0 -test.v=true -test.timeout=3m0s HcS8Y-jUi .cfg ux_amd64/vet -p g/protobuf/ptype-test.testlogfile=/tmp/go-build1927090654/b001/testlog.txt -lang=go1.23 ux_amd64/vet -o om/cenkalti/back-test.run=TestStore_GetRunningExecutions om/cenkalti/backoff/v5@v5.0.3/er-ifaceassert ux_amd64/vet points.go /tools/clientcmd-V=full -lang=go1.21 ux_amd64/vet(packet block)127.0.0.14/tmp/go-build2632617950/b001/dkron.test /tmp/go-build2632617950/b001/dkron.test -test.testlogfile=/tmp/go-build2632617950/b001/testlog.txt -test.paniconexit0 -test.v=true -test.timeout=3m0s HcS8Y-jUi .cfg ux_amd64/vet -p g/protobuf/ptype-test.testlogfile=/tmp/go-build1927090654/b001/testlog.txt -lang=go1.23 ux_amd64/vet -o om/cenkalti/back-test.run=TestStore_GetRunningExecutions om/cenkalti/backoff/v5@v5.0.3/er-ifaceassert ux_amd64/vet points.go /tools/clientcmd-V=full -lang=go1.21 ux_amd64/vet(packet block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.