Skip to content

main: update tokio for RUSTSEC-2026-0386, and keep the block-proof acknowledgement bound from dropping a disposition poll's connection - #781

Merged
kiwidream merged 2 commits into
mainfrom
kiwidream/fix-pr-780
Oct 26, 2026
Merged

kiwidream merged 2 commits into
mainfrom
kiwidream/fix-pr-780

Conversation

@kiwidream

@kiwidream kiwidream commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Fixes the two independent failures on #780's CI (run 40351435557). #780 only adds a Markdown file, so both failures come from main itself. The other two red checks, Prove every Rust PRISM gated test executed and Lint, compile, and test, only report that shard 3 and the audit job failed.

Check Cause Fix
Dependency audit RUSTSEC-2026-0386, published after #778 merged: tokio 1.53.1's safe AsyncFd constructors violate I/O safety. Every PR into main fails this check now. tokio 1.53.1 → 1.53.3, its first fixed patch, in the root and fuzz lockfiles
PRISM PostgreSQL shard 3 b574_ack_cap::a_captured_proof_is_answered_at_the_cap_and_credited_after_its_landing: proxy connection task failed: Connection reset by peer (os error 104) Run each disposition poll in its own task, so the ack bound never cancels it partway through a checkout

1. tokio for RUSTSEC-2026-0386

As #777 did for the TLS advisories, this moves tokio to its first fixed patch release. Nothing in the workspace uses AsyncFd. Only tokio's version and checksum change: cargo update -p tokio --precise 1.53.3 also moved the windows-sys edges of four unrelated crates (errno, quinn-udp, rustix, tempfile) from 0.61.2 to 0.52.0, so the edit leaves those alone. Both lockfiles pass cargo metadata --locked.

2. The b574_ack_cap connection reset

The test passed, but the ledger execution proxy then failed the run while the fixture was closing. Its client socket had received a TCP reset. deferred_share_disposition wrapped each poll's checkout and SQL in timeout_at(bound, …). Sometimes the bound expired while the checkout was still running:

  • during the pool's before_acquire ping, which runs once a connection has been idle for 100 ms and is the likely case, since the loop polls every 50 ms across several pooled connections, or
  • during a new connection's setup.

When that happened, SQLx dropped the raw connection with the reply still unread. The kernel then answered with a reset, which the proxy treats as an error by design (#440). The same drop also costs production a healthy pooled connection, and PostgreSQL logs it as a client reset.

The poll now runs in its own task, as the duplicate probe and enqueue already do (#574), and only the wait for it is bounded. Answers, phases and block_proof_ack_capped_total are unchanged. A poll that is still running at the bound, or when the submission is cancelled, finishes on its own and returns its connection. database_pool_acquire_seconds therefore records that checkout when it ends, not as a cancelled failure at the bound. Two acquire tests asserted the old cancellation and now assert this. docs/prism-pool-acquire-metrics.md is updated to match.

Evidence

  • This failure has not appeared in any failed PostgreSQL shard log since 2026-10-01 (52 scanned). Locally the test passed 100 of 100 sequential runs, so it is a rare scheduling race.
  • To make the race reproducible, a local-only diagnostic patch (not committed) leaves the checkout ping's reply unread for 20 ms. With it, unfixed main failed 26 of 30 runs, every time with exactly the CI error. With this fix and the same patch, it passed 30 of 30.

Checked locally

  • cargo deny --locked check: advisories, bans, licenses and sources ok. As a control, origin/main fails the advisories check with RUSTSEC-2026-0386.
  • cargo fmt --all -- --check; cargo clippy --locked --workspace --all-targets -- -D warnings.
  • python3 scripts/check_prism_pool_acquires.py with its unit tests, and python3 scripts/check_toolchain_pin.py.
  • coordinator::miner_submit::acquire_tests: 10 of 10 against PostgreSQL 16.
  • The full cargo test --locked -p qbit-prism-server against PostgreSQL 16: 2,112 passed. The only failure was public_database_config, caused by my cluster's trust-all pg_hba.conf; it passes under the SCRAM pg_hba.conf that test/prism-native-tests.sh writes. The qbitd tests skipped because this host has no qbitd.
  • After the local review's fix: the lib suite 703 of 703 (at 4 threads; at 6, four unrelated lock-timeout and deadline tests failed and then passed on their own), b574_ack_cap 22 of 22, b478_capture_overpay 29 of 29, lost_race_pin 8 of 8, compact_runtime_e2e 35 of 35.

Review notes

3.x.x and 3.0.x have the same tokio 1.53.1 pin and the same poll code, so they need the same changes.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

kiwidream and others added 2 commits October 26, 2026 12:59
The Dependency audit job (`cargo deny --locked check`) fails on
RUSTSEC-2026-0386: tokio 1.53.1's safe `AsyncFd` constructors violate
I/O safety. Move tokio to its first fixed patch release, 1.53.3, in the
root and fuzz lockfiles, as #777 did for the TLS advisories. Nothing in
the workspace uses `AsyncFd`.

Only tokio's version and checksum change. `cargo update -p tokio
--precise 1.53.3` also moved the windows-sys edges of four unrelated
crates (errno, quinn-udp, rustix, tempfile) from 0.61.2 to 0.52.0, so
the edit keeps those as they were; both lockfiles pass
`cargo metadata --locked`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…osition poll's connection

b574_ack_cap's a_captured_proof_is_answered_at_the_cap_and_credited_after_its_landing
failed on #780 with `proxy connection task failed: Connection reset by
peer (os error 104)`, which the ledger execution proxy reported when the
fixture closed.

`deferred_share_disposition` wrapped each poll's checkout and SQL in
`timeout_at(bound, ...)`. When the bound fell inside the checkout,
during the pool's `before_acquire` ping of a connection idle for 100 ms
or a new connection's setup, SQLx dropped the raw connection with the
reply unread, and the kernel answered with a TCP reset. The test proxy
reports that as a failed connection; PostgreSQL logs it as a client
reset, and the pool loses a healthy connection.

Each poll now runs in its own task, as the duplicate probe and enqueue
do (#574), and only the wait for it is bounded. Answers, phases and
`block_proof_ack_capped_total` are unchanged. A poll still running at
the bound, or when the submission is cancelled, finishes on its own and
returns its connection, so `database_pool_acquire_seconds` records its
checkout when it ends instead of as a cancelled failure. Two acquire
tests and docs/prism-pool-acquire-metrics.md now say so. A bound already
past on entry, as for a #657 capture that committed in the share grace,
starts no poll: the old code's poll there could only be cut off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T17:01:12.246898Z 2608df7 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@qbit-reviewer

qbit-reviewer Bot commented Oct 26, 2026

Copy link
Copy Markdown

Reviewed at 2608df7: 0 findings shared privately with maintainers.

@kiwidream
kiwidream merged commit b9579c6 into main Oct 26, 2026
39 checks passed
RobertClarke added a commit that referenced this pull request Oct 26, 2026
* 3.x.x: version 3.1.0, and tokio 1.53.3 for RUSTSEC-2026-0386

VERSION, the workspace version and both lockfiles' workspace members move
to 3.1.0. tokio moves from 1.53.1 to 1.53.3, its first fixed patch
release for RUSTSEC-2026-0386, in the root and fuzz lockfiles, as main
took it in #781. cargo update -p tokio --precise 1.53.3 also moved the
windows-sys edges of four unrelated crates to 0.52.0, so, as in #781,
only tokio's version and checksum change. Nothing in the workspace uses
AsyncFd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* 3.x.x: 3.1.0 release notes, and 3.x.x as the production line

doc/release-notes-3.1.0.md covers the changes since 3.1.0-rc.1 (#777's
TLS updates and the tokio update), the upgrade from rc.1 (a binary swap)
and from 3.0.0 or 3.0.0-rc.6 (#773's pre-migrate, the binary, then the
optional dual-writer cutover), and the known issues carried from rc.1
plus #779's L3 failures and the acknowledgement bound's connection drop
that main fixes in #781. The README banner, the development-line note
and the migration guide now say 3.x.x is the production line, deployed
from the v3.1.0 tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* 3.x.x: 3.1.0 notes: review fixes

The migration guide and ledger operations cite the released 3.0.0 notes'
D5 boundary at v3.0.0, not this branch's pre-release copy. The
development-line note's header no longer calls the line "not a release".
The 3.1.0 notes say a dual-writer-off frontend serves as 3.0's does once
the migrations are applied, tell a 2.0.x upgrade that #765's guard is not
needed, and list the required prism-dual-writer lane and rc.1's evidence
set under Verification.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* 3.x.x: 3.1.0 notes: second review round

The #779 known issue counts the async preset's failed repeats (four of
six) and names the sync preset rather than a repeat's job. The cutover
step names node-identity repersonalise and defers the cutover itself to
the pair's runbook, as rc.1's notes do. Verification says docs changed
since rc.1 too. The development-line note says 3.0.x is not an ancestor
of 3.1.0, and the migration guide no longer implies the 3.0.0
candidates were a supported production upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* 3.x.x: 3.1.0 notes: rewrap two lines

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant