[29.x] Finalise 29.5 #36666

Manually merged
fanquake merged 7 commits from finalise_29_5 into 29.x 2026-10-26 22:02:10 +00:00 AGit
fanquake commented 2026-10-26 14:05:03 +00:00 (Migrated from github.com)

Backports:

Backports: * #36665 * #36667 * #36669
DrahtBot commented 2026-10-26 14:05:22 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK darosior, willcl-ark, sedited, l0rinc

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36666 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36666.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36666#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [darosior](https://github.com/bitcoin/bitcoin/pull/36666#pullrequestreview-5658621307), [willcl-ark](https://github.com/bitcoin/bitcoin/pull/36666#pullrequestreview-5658750176), [sedited](https://github.com/bitcoin/bitcoin/pull/36666#pullrequestreview-5658951822), [l0rinc](https://github.com/bitcoin/bitcoin/pull/36666#issuecomment-6427648853) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--5faf32d7da4f0f540f40219e4f7537a3-->
First-time contributor

Base: 1a4f19f6e66c7b4e458e2cf83513473e9a78f4e3
Head: dee8c7186f26bfa1623b4d1cda77081292a8574e

Backport verdict: Defective

The target commits represent all four listed upstream source commits, but the flat-file follow-up does not provide 64-bit positioning on 32-bit POSIX: its non-Windows helper still delegates to fseek/ftell. This is a concrete limitation in the backported implementation.

Evidence:

  • Target commit b3526cf152 maps to upstream 1e0c407377 and applies the receive-gated exception-set change in WaitMany.
  • Target commit 02c76d5d5f maps to upstream cc2534cdf7 and adds the pause timestamp and timeout. The target uses GetTimestd::chrono::seconds(), matching the existing target InactivityCheck time basis.
  • Target commit 5c99cb6745 maps to upstream 17556cb1f5 and widens flat-file and block-position fields. The target’s header layout differs from upstream, with corresponding declarations in chain.h and interfaces/chain.h; the supplied target diff shows those adaptations. Position serialization remains varint-based.
  • Target commit b2994bd0f5 maps to upstream 48092a9042. It adds the Windows 64-bit positioning calls, but the non-Windows branches still use std::fseek and std::ftell.
  • The packet lists no missing source commits: the four mapped target commits account for the one source commit from #36665, one from #36667, and two from #36669. The untagged release-preparation commits update the version, generated manual pages, and release notes; the notes mention all three backported PRs.

Required fixes:

  • Use off_t-based 64-bit positioning calls such as fseeko and ftello in the non-Windows branches on platforms where long is narrower than the supported position range.

Limitations:

  • The undo-reading, file-finalization, and pruning consumers were not fully traced, so end-to-end handling of every widened persisted offset remains unverified.
  • This is a static assessment; no builds or tests were executed.

Previously reported concerns remain unresolved: 3 suggestion, 2 minor. Author deferral or disagreement does not resolve a finding.

Previous findings and author responses
suggestion · Document why exception monitoring is gated by RECV

Status: still_present. Author position: none.

src/util/sock.cpp:213 at 109b8fe0b1

Could you add a short comment explaining why this `select` exception set is gated by `RECV`? `SocketHandlerConnected` treats `ERR` as a reason to call `Recv()` even when `RECV` was not reported, while `GenerateWaitSockets` omits `RECV` under `fPauseRecv`. That makes the placement a non-obvious receive-backpressure safeguard; restoring the old unconditional registration can again trigger `Recv()` while receive is paused.

The new select exception-set condition still lacks an explanation. GenerateWaitSockets can request SEND without RECV while receive is paused, and SocketHandlerConnected treats ERR as a reason to call Recv; the non-obvious rationale remains useful to document.

minor · Preserve ERR reporting for SEND-only select waits

Status: still_present. Author position: none.

src/util/sock.cpp:213 at ccf3c78885

For a SEND-only wait, this branch does not put the socket in select's exception set, so an exceptional condition on it is not returned as ERR, despite the Sock API contract that ERR may be added even when it was not requested. GenerateWaitSockets can create SEND-only watches when receive processing is paused while output remains pending, and SocketHandlerConnected handles errors only when ERR is reported. No current producer of exceptional readiness during a SEND-only watch was identified, so production impact is unconfirmed. Please preserve this notification or explicitly narrow the API contract and adjust the caller to handle the omitted condition.

For SEND-only select waits, the socket is not added to err, while the unchanged Sock API contract says ERR may be returned for an exceptional event even when not requested. The poll backend continues to map POLLERR and POLLHUP to ERR.

suggestion · Add regression coverage for the paused-send timeout

Status: still_present. Author position: none.

src/net.cpp:2048 at ccf3c78885

Please add a regression test for this timeout and its recovery behavior. Keep a peer's send buffer paused beyond the interval while maintaining enough ordinary peer activity to avoid the existing inactivity timeouts, then verify disconnection; also verify that draining below the threshold before the deadline prevents disconnection and a later pause starts a new interval. The checked-in tests do not exercise this timer, so its timeout and transition behavior can regress without detection. Use mock time rather than waiting in real time.

The paused-send timer is added in the networking code, but the checked-in test search showed no coverage of m_pause_send_since or this timeout’s pause/recovery transitions. The requested mock-time regression coverage remains absent from the evidence checked.

minor · Use large-file positioning calls on 32-bit POSIX

Status: still_present. Author position: none.

src/util/fs_helpers.h:42 at f089ba87ca

On 32-bit POSIX builds, the non-Windows branches still pass offsets through `std::fseek`'s `long` argument and return positions through `std::ftell`'s `long` result; `_FILE_OFFSET_BITS=64` widens `off_t`, not `long`. Consequently, `FlatFileSeq::Open` cannot reliably seek to positions above `LONG_MAX`, and `FileTell64` cannot report them. Please use off_t-based positioning calls such as `fseeko`/`ftello` on POSIX as well. The checked-in block/undo writer caps block files at 128 MiB, and no current caller producing a position above `LONG_MAX` was identified, so production impact is unconfirmed.

The non-Windows helper still delegates to fseek/ftell, so offsets above LONG_MAX are not reliably supported on 32-bit POSIX. The base position was unsigned int and used fseek; the change widens the representable position range but leaves the new helper’s POSIX path limited.

suggestion · Include the integer header directly

Status: unclear. Author position: none.

src/flatfile.h:17 at f089ba87ca

Could `flatfile.h` include `<cstdint>` directly? `FlatFilePos::nPos` now uses `uint64_t`, but the header currently obtains that definition through `serialize.h`. The developer notes ask each file to include headers for definitions it directly uses, avoiding fragile transitive dependencies and making the header's requirements clear.

The changed header uses uint64_t without directly including <cstdint>, but the cited repository guidance requiring direct includes was not independently verified within the available source inspection.

Review coverage was incomplete.

Review limitations
  • adversarial: The inspection limit prevented reading src/index/txindex.cpp and the undo-reading, file-finalization, and pruning consumers in src/node/blockstorage.cpp. End-to-end handling of the widened persisted offsets remains unverified.
  • verifier: The supplied inspection gap was only partly resolved: txindex and some block/undo write paths were inspected, but the undo-reading, file-finalization, and pruning consumers were not traced end to end. This limits verification of all persisted-offset consumers and whether any current producer reaches offsets above LONG_MAX.
  • verifier: Finding withheld: Source evidence does not match the snapshot
  • verifier: The undo-reading, file-finalization, and pruning consumers were not fully traced, so end-to-end handling of every widened persisted offset remains unverified.
  • verifier: This is a static assessment; no builds or tests were executed.

Full review report

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:30dd55d4dcd398b3877cd3933c74eed6a0ac8ca15dc75176a8415d8d0cdfd387:86b9a0e22bd2eb7ab1b7eb621b9854197174a699ec1bc40495f2801bb5137d33 --> Base: `1a4f19f6e66c7b4e458e2cf83513473e9a78f4e3` Head: `dee8c7186f26bfa1623b4d1cda77081292a8574e` <!-- ralph-case:9b4efdf29b90f3d4321a47fecc6feb52895c1d97b09d94b1b8f9767a31b7ed53 --> Backport verdict: **Defective** The target commits represent all four listed upstream source commits, but the flat-file follow-up does not provide 64-bit positioning on 32-bit POSIX: its non-Windows helper still delegates to fseek/ftell. This is a concrete limitation in the backported implementation. Evidence: - Target commit b3526cf1520504c50c44cdbf0b7b26a61b8060c9 maps to upstream 1e0c407377034e9cbb4d52f1f534c06cdf202a36 and applies the receive-gated exception-set change in WaitMany. - Target commit 02c76d5d5f4848e65868357eb8fdd10df1053bc7 maps to upstream cc2534cdf7b14d0f1a18928ebaab7f7fdd7e839e and adds the pause timestamp and timeout. The target uses GetTime<std::chrono::seconds>(), matching the existing target InactivityCheck time basis. - Target commit 5c99cb67452b28a16e9e44f2825e9b3257f1e1f9 maps to upstream 17556cb1f52fcbc807f65245101f72e8ec1573d8 and widens flat-file and block-position fields. The target’s header layout differs from upstream, with corresponding declarations in chain.h and interfaces/chain.h; the supplied target diff shows those adaptations. Position serialization remains varint-based. - Target commit b2994bd0f5896cc32a19b3fc01a483fdb90ea330 maps to upstream 48092a9042d8fcfd6bb7ae5911a1d53b8746d546. It adds the Windows 64-bit positioning calls, but the non-Windows branches still use std::fseek and std::ftell. - The packet lists no missing source commits: the four mapped target commits account for the one source commit from #36665, one from #36667, and two from #36669. The untagged release-preparation commits update the version, generated manual pages, and release notes; the notes mention all three backported PRs. Required fixes: - Use off_t-based 64-bit positioning calls such as fseeko and ftello in the non-Windows branches on platforms where long is narrower than the supported position range. Limitations: - The undo-reading, file-finalization, and pruning consumers were not fully traced, so end-to-end handling of every widened persisted offset remains unverified. - This is a static assessment; no builds or tests were executed. Previously reported concerns remain unresolved: 3 suggestion, 2 minor. Author deferral or disagreement does not resolve a finding. <details> <summary>Previous findings and author responses</summary> <h6>suggestion · Document why exception monitoring is gated by RECV</h6> <p>Status: still_present. Author position: none.</p> <p>src/util/sock.cpp:213 at 109b8fe0b1ee66cad88fcfb17a59c09add084e7d</p> <pre>Could you add a short comment explaining why this `select` exception set is gated by `RECV`? `SocketHandlerConnected` treats `ERR` as a reason to call `Recv()` even when `RECV` was not reported, while `GenerateWaitSockets` omits `RECV` under `fPauseRecv`. That makes the placement a non-obvious receive-backpressure safeguard; restoring the old unconditional registration can again trigger `Recv()` while receive is paused.</pre> <p>The new select exception-set condition still lacks an explanation. GenerateWaitSockets can request SEND without RECV while receive is paused, and SocketHandlerConnected treats ERR as a reason to call Recv; the non-obvious rationale remains useful to document.</p> <h6>minor · Preserve ERR reporting for SEND-only select waits</h6> <p>Status: still_present. Author position: none.</p> <p>src/util/sock.cpp:213 at ccf3c788858d5d167da23e71ee59bd50eac3379a</p> <pre>For a SEND-only wait, this branch does not put the socket in select&#x27;s exception set, so an exceptional condition on it is not returned as ERR, despite the Sock API contract that ERR may be added even when it was not requested. GenerateWaitSockets can create SEND-only watches when receive processing is paused while output remains pending, and SocketHandlerConnected handles errors only when ERR is reported. No current producer of exceptional readiness during a SEND-only watch was identified, so production impact is unconfirmed. Please preserve this notification or explicitly narrow the API contract and adjust the caller to handle the omitted condition.</pre> <p>For SEND-only select waits, the socket is not added to err, while the unchanged Sock API contract says ERR may be returned for an exceptional event even when not requested. The poll backend continues to map POLLERR and POLLHUP to ERR.</p> <h6>suggestion · Add regression coverage for the paused-send timeout</h6> <p>Status: still_present. Author position: none.</p> <p>src/net.cpp:2048 at ccf3c788858d5d167da23e71ee59bd50eac3379a</p> <pre>Please add a regression test for this timeout and its recovery behavior. Keep a peer&#x27;s send buffer paused beyond the interval while maintaining enough ordinary peer activity to avoid the existing inactivity timeouts, then verify disconnection; also verify that draining below the threshold before the deadline prevents disconnection and a later pause starts a new interval. The checked-in tests do not exercise this timer, so its timeout and transition behavior can regress without detection. Use mock time rather than waiting in real time.</pre> <p>The paused-send timer is added in the networking code, but the checked-in test search showed no coverage of m_pause_send_since or this timeout’s pause/recovery transitions. The requested mock-time regression coverage remains absent from the evidence checked.</p> <h6>minor · Use large-file positioning calls on 32-bit POSIX</h6> <p>Status: still_present. Author position: none.</p> <p>src/util/fs_helpers.h:42 at f089ba87cabe4f85397edf9d72dbace2cae634ce</p> <pre>On 32-bit POSIX builds, the non-Windows branches still pass offsets through `std::fseek`&#x27;s `long` argument and return positions through `std::ftell`&#x27;s `long` result; `_FILE_OFFSET_BITS=64` widens `off_t`, not `long`. Consequently, `FlatFileSeq::Open` cannot reliably seek to positions above `LONG_MAX`, and `FileTell64` cannot report them. Please use off_t-based positioning calls such as `fseeko`/`ftello` on POSIX as well. The checked-in block/undo writer caps block files at 128 MiB, and no current caller producing a position above `LONG_MAX` was identified, so production impact is unconfirmed.</pre> <p>The non-Windows helper still delegates to fseek/ftell, so offsets above LONG_MAX are not reliably supported on 32-bit POSIX. The base position was unsigned int and used fseek; the change widens the representable position range but leaves the new helper’s POSIX path limited.</p> <h6>suggestion · Include the integer header directly</h6> <p>Status: unclear. Author position: none.</p> <p>src/flatfile.h:17 at f089ba87cabe4f85397edf9d72dbace2cae634ce</p> <pre>Could `flatfile.h` include `&lt;cstdint&gt;` directly? `FlatFilePos::nPos` now uses `uint64_t`, but the header currently obtains that definition through `serialize.h`. The developer notes ask each file to include headers for definitions it directly uses, avoiding fragile transitive dependencies and making the header&#x27;s requirements clear.</pre> <p>The changed header uses uint64_t without directly including &lt;cstdint&gt;, but the cited repository guidance requiring direct includes was not independently verified within the available source inspection.</p> </details> Review coverage was incomplete. <details> <summary>Review limitations</summary> - adversarial: The inspection limit prevented reading src/index/txindex.cpp and the undo-reading, file-finalization, and pruning consumers in src/node/blockstorage.cpp. End-to-end handling of the widened persisted offsets remains unverified. - verifier: The supplied inspection gap was only partly resolved: txindex and some block/undo write paths were inspected, but the undo-reading, file-finalization, and pruning consumers were not traced end to end. This limits verification of all persisted-offset consumers and whether any current producer reaches offsets above LONG_MAX. - verifier: Finding withheld: Source evidence does not match the snapshot - verifier: The undo-reading, file-finalization, and pruning consumers were not fully traced, so end-to-end handling of every widened persisted offset remains unverified. - verifier: This is a static assessment; no builds or tests were executed. </details> [Full review report](<https://review.fish.foo/traces/36666-dee8c7186f26bfa1623b4d1cda77081292a8574e-1423-8.html>)
l0rinc (Migrated from github.com) approved these changes 2026-10-26 18:06:19 +00:00
l0rinc (Migrated from github.com) left a comment

ACK 109b8fe0b1

Reviewed the cherry-pick manually and checked the remaining commits automatically. The patch matches upstream apart from the older RECV/SEND names.

ACK 109b8fe0b1ee66cad88fcfb17a59c09add084e7d Reviewed the cherry-pick manually and checked the remaining commits automatically. The patch matches upstream apart from the older `RECV`/`SEND` names.
l0rinc commented 2026-10-26 18:44:26 +00:00 (Migrated from github.com)

reACK ccf3c78885

Reviewed the added #36667 cherry-pick, with the same clock and logging adaptations as v30.

reACK ccf3c788858d5d167da23e71ee59bd50eac3379a Reviewed the added #36667 cherry-pick, with the same clock and logging adaptations as v30.
darosior (Migrated from github.com) reviewed 2026-10-26 20:04:08 +00:00
darosior (Migrated from github.com) left a comment
273560fc92b777437ee6e4f6f7c0e5bd8a6584bb says "Github-Pull: https://github.com/bitcoin/bitcoin/pull/3666" instead of #36669
darosior (Migrated from github.com) reviewed 2026-10-26 20:36:43 +00:00
darosior (Migrated from github.com) left a comment
ACK dee8c7186f26bfa1623b4d1cda77081292a8574e
willcl-ark (Migrated from github.com) approved these changes 2026-10-26 20:47:42 +00:00
willcl-ark (Migrated from github.com) left a comment

ACK dee8c7186f

Backports LGTM.

ACK dee8c7186f26bfa1623b4d1cda77081292a8574e Backports LGTM.
sedited (Migrated from github.com) approved these changes 2026-10-26 21:02:18 +00:00
sedited (Migrated from github.com) left a comment

Reproduced ACK dee8c7186f

Reproduced ACK dee8c7186f26bfa1623b4d1cda77081292a8574e
l0rinc commented 2026-10-26 21:23:05 +00:00 (Migrated from github.com)

reACK dee8c7186f

#36669 cherry-pick also looks fine

reACK dee8c7186f26bfa1623b4d1cda77081292a8574e #36669 cherry-pick also looks fine
Sjors commented 2026-10-27 11:36:39 +00:00 (Migrated from github.com)

ACK dee8c7186f

I also reviewed the backported PRs.

ACK dee8c7186f26bfa1623b4d1cda77081292a8574e I also reviewed the backported PRs.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36666
No description provided.