Repository navigation
Let the re-key wait on a busy issue store as long as issue.mjs - #2
Merged
Merged
Conversation
The re-key is a CLI, but it took the issue lock with the request handler's budget of 50 rounds of 20ms. bin/issue.mjs waits 250. On a loaded runner, eight mints holding the lock in turn outlasted that second, and the re-key refused with exit 4. That failed "a re-key running beside live mints loses none of them" once on Ubuntu Node 22. It now waits 250 rounds. A new test holds the lock for 2s from another process: the old re-key refuses and the new one completes.
The re-key wait test spawned its lock holder with an inline module that imported './monitor/issue-store.mjs'. Resolved from bin/test that file does not exist, and tracked-imports failed on every CI job: the guard reported an untracked import, and V8 disagreed with the extractor. The child now imports the module by a file URL built at run time, as ledger-rotate-concurrent does.
This was referenced Oct 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes the Ubuntu Node 22 failure that showed up once on #1's CI run (38061636846) and passed on rerun:
bin/test/issue-store-concurrency.test.mjs, "a re-key running beside live mints loses none of them".Cause
bin/issue-rekey.mjs --writetook the issue-store lock withwithIssuesLock's default of 50 attempts of 20 ms each, about 1 s. That default is the request-handler budget. The lock's contract inmonitor/issue-store.mjssays a CLI may wait longer, andbin/issue.mjswaits 250 attempts. On a loaded runner, the test's eight concurrent mints held the lock in turn for more than a second. The re-key then gave up with exit 4 ("issue store is locked by another process; try again"), and the test requires it to complete.Fix
The re-key now takes the lock with
attempts: 250, the same asbin/issue.mjs.Test
The new test, "a re-key waits out a writer that holds the lock longer than a request handler would", runs in about 2 s. A child process takes the lock and holds it for 2 s, which is longer than the old budget and well inside the new one. Then the re-key runs.
issue-store-concurrency.test.mjspassed 4/4 on three consecutive runs.issue-rekey-depsretire,issue,one-mutex,focus-rekeyandtracked-importspass, andnode bin/reference.mjs --checkexits 0.