Repository navigation
Remove the PRISM first-job admission lock convoy - #171
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7dd52ce8e8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| and len(self._pending_initial_jobs) >= capacity | ||
| ): | ||
| self.initial_job_queue_rejection_count += 1 | ||
| reject = True |
There was a problem hiding this comment.
Reserve capacity before accepting reauthorization
When an already-working miner reauthorizes while the initial-job queue is nearly full, the mining.authorize pre-check can observe available capacity, release the coordinator lock, mutate the authorization generation, and send a success response; another connection can then claim the last admission slot before this authoritative check runs. This branch consequently rejects and disconnects the reauthorized miner because its old job is no longer current, defeating the pre-check's stated guarantee of preserving a working session. Reserve the slot during the pre-check or make reauthorization and admission a single atomic operation.
Useful? React with 👍 / 👎.
Closes #159.
Problem
A reconnect herd made first-job progress through the fleet-wide coordinator lock for per-connection anchoring, admission-map bookkeeping, and an O(N) current-tip coverage scan repeated after every delivery. At 1,024 sessions that formed an O(N²) lock convoy and could leave a subset of miners without re-established work.
Design
client.tip_work_deliveredas a first-write-per-tip anchor under the existing per-client job-update lock. Delivery no longer takes the coordinator lock or runs a fleet census, and same-tip refreshes cannot slide the stale-grace anchor.JobDeliveryService.1,024-session acceptance
The landed #170 driver was run twice as matched baseline/fixed pairs on the same eight-core host with the same command and default positive/negative controls:
--connections 1024 --mode herd --settle-seconds 50 --measure-seconds 30 --herd-return-seconds 50 --connect-timeout-seconds 50 --ledger memory --difficulty-mode resume --jsonAll four runs passed their controls and had empty stderr. Fixed-run positive controls reached 7.45 and 7.33 cores; negative controls measured 1.02 and 1.01 cores. Both fixed runs also reported zero accept errors and zero sessions left behind.
Verification
docker,lab,tests,examples, andscripts.E4,E7,E9,Fpassed on every changed path with the repository's pre-existing forward-referenceF821findings excluded. The unexcluded findings on changed paths are byte-identical to the base tree.Sequencing and residual risk
This lands last, after #170, #168, and #167. It is based directly on the resulting
2.x.xtip and is intentionally not stacked on #166; the admission/observability delta does not depend on that open PR.The historical 30–82% coordinator-lock contention range was not reproduced by this synthetic driver. Global contention remained low but rose from 0.40%/0.74% in the two baselines to 1.02%/1.03% in the fixed runs because the fixed tree completed all 1,024 sessions and therefore executed more downstream work. The acceptance result is the per-session census, not a claim that every remaining coordinator-lock site is optimized. Coverage-failure reset now occurs at the observability refresh cadence rather than synchronously on an individual delivery.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.