Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 908aa34a27
ℹ️ 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".
| val length = layout.v2Piece(index.toLong()).length.toInt() | ||
| val blocks = (length + PeerWire.BLOCK_SIZE - 1) / PeerWire.BLOCK_SIZE | ||
| // Includes payload, received flags, bounded missing-index snapshots and container allowance. | ||
| val lease = budget.reserve(length + blocks * 32 + 512) ?: return null |
There was a problem hiding this comment.
Reserve headroom for the store's commit copy
With the permitted 16 MiB piece length and the default 32 MiB transfer budget, this lease consumes 16 MiB plus 33,280 bytes for assembly bookkeeping. After delivery leases are released, TorrentV2PieceStore.commit() still reserves another full 16 MiB at TorrentV2PieceStore.kt:112, exceeding the budget by 33,280 bytes, so every full-size piece deterministically fails storage admission and is discarded. Creation must account for the commit copy's headroom, or the consuming commit must reuse the assembly's admitted buffer ownership.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 8013ac4. Complete assemblies now seal their private admitted buffer and use the store’s owned-buffer path, retaining its reservation until validation/write/flush unwinds. Ordinary mutable caller buffers still use the defensive private copy, and both paths share the same integrity and flush/publication barrier. Closing a committing assembly cannot release credit early.
The new full 16 MiB piece test reproduced the prior failure (Payload buffer budget exhausted) under a 32 MiB budget and passes after the fix. Additional coverage verifies credit retention and cancellation while waiting for storage admission. Focused JVM/storage tests and iOS compilation pass. The descendant inbox head 3a0f0cd includes this fix and passes 449 JVM plus 428 executed iOS tests, including the full-size regression, TCP integration, both conformance scenarios and the native-runtime guard.
|
Superseded by #236 (V2 scheduling and download execution) in the consolidated eight-PR stack for #162. The replacement preserves this PR's code and subsequent fixes; its description links the original head and review discussions. The only additional consolidation fix is the CI-discovered listener cancellation regression, documented on the replacement. All eight replacements have passed their required CI checks. Closing without merging. This branch and its discussions remain available for reference. Review index: #162 (comment) |
V2 peer blocks are assembled under an independent reservation before verified storage commit. The assembly accepts canonical blocks out of order and rejects invalid/duplicate ranges. Complete assemblies seal their admitted payload and retain credit until the store validates, writes and flushes it. This avoids a second full-size reservation, allowing a 16 MiB piece to commit within the default 32 MiB transfer budget. Ordinary mutable buffers retain the store’s defensive copy path.
Stacked on #194, under #162. Full event-loop/timer wiring, multi-peer scheduling, upload/hash serving and runtime integration remain unfinished.
Validation:
908aa34apassed 442 JVM and 421 executed iOS tests, conformance and native-runtime guard.8013ac45passes focused assembly/storage JVM tests and iOS compilation. The full-size regression failed before the fix and now passes, with cancellation coverage for reservation retention while awaiting storage admission.3a0f0cd7includes the fix and passes 449 JVM and 428 executed iOS tests, both pinned v1 conformance scenarios and the native-runtime guard.