Repository navigation
chore(io): check a compio stream's descriptor before each raw use - #166
Merged
Merged
Conversation
A region's log ended at "sending a file region" whether the socket took it whole or the send never finished, so a server's record could not tell a body that went out from one that did not. The connection now records the region's end as well. Refs #159
A file region on compio once reached the peer as a 200 head, no body and a clean FIN. The head and the shutdown name the socket by its slot in the ring's file table, while the body's splice names it by descriptor number; both reaching the peer except the body fits a number closed and reused while the slot kept the socket open. Debug builds now record the socket's device and inode when a stream is made and compare them before every use of the number: each raw splice, FIONBIO, the AsFd handed to kTLS and to callers, and each operation submitted through the slot holder. A mismatch panics naming what the number now holds, so the next failure points at the reuse instead of losing bytes. Refs #159
An operation submitted while the stream holds its slot names the socket by the slot, so the number may legitimately point elsewhere then (the registered-slot test points it at /dev/null). The identity check moves into the slot holder and runs only for an operation that names the descriptor; raw syscalls and AsFd keep theirs. Refs #159
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Diagnostics for #159, where a file region's bytes left the server as reported sent yet never reached the client. Reading the send path rules out a zero-byte result taken as done, reads at the shared file offset and a dropped response; what remains is a raw-descriptor syscall (the pipe drain,
to_pipe/from_pipe,FIONBIO,AsFd) acting on a number that no longer names the stream's socket while slot-addressed operations still reach it.In debug builds a compio stream now records its socket's identity (
st_dev/st_ino/type) and checks it before each use of the raw number, panicking with what the number names instead; operations addressed through the registered slot are not checked, since their number does not matter. h1 also records when a file region has finished sending, so a trace that ends atsending a file regionnow means the send never finished. A test puts a file over a stream's number withdup2and expects the check to fire.Refs #159