Repository navigation
Conversation
MDA2AV
marked this pull request as draft
October 24, 2026 22:02
This was referenced Oct 26, 2026
- Rename IdleTimeoutMs to ReadTimeoutMs on the TCP and QUIC options, and document what the read timeout and the send timeout bound now (#929, #917) - Drop the raw shutdown(2) calls: DecRef sends the FIN itself, after any send in flight (#929) - Take the FlushResult the HTTP/2 and HTTP/3 writers return, and end a streamed body with ConnectionClosedException once the peer is gone, so a server-sent event source notices the client left (#932) - Rethrow a fault that happens after the headers are out, so ioxide resets the stream instead of ending a truncated body cleanly (#930) - TLS on the TCP transports is terminated in BoringSSL now; update the docs and samples
Set Reactor.OnFault, so a reactor that cannot start - a ring the kernel refuses, a port already taken, a throw from OnStart - fails StartAsync with its reason instead of ending the process from the reactor's thread. The other reactors are stopped again, rather than serving one reactor short. A reactor that faults after it started is logged as critical (#933).
SynchronizeWrites() on the builder makes the connection serialize every write and its flush, including the pong and close frames the default OnPing and OnClose handlers send from the message pump - which an application's own write lock never covers. Off by default; the docs on OnPing, OnClose and ISocketConnection now say which writes need serializing (#914).
Both drivers ran the handler, wrote the head and the body and handled a fault the same way, line for line, apart from the ioxide writer they held. That part is now StreamedDriver.DispatchAsync, driven through a small IStreamedWriter adapter per protocol; each driver keeps only the mapping of its own request.
…ss debug logging is on
IdleTimeoutMs stays as an obsolete alias on both, so code that sets it keeps compiling.
…nd serve static files straight into the write buffer - ioxide 0.26.563, from 0.20.396: HTTP/2 and HTTP/3 run through the one RunAsync whose handler takes the body reader, so request bodies stream. Nothing else the engine uses changed. - #971: since ioxide 0.24 a reactor has no SynchronizationContext, so a handler that awaits something other than ioxide comes back on the thread that completed it. Both drivers take the reactor when they start and await a ReactorSwitch right after the handler, so the response, and the thread-statics it reads, are on the reactor again. - #975: IIoxideFileSink in GenHTTP.Api.Ioxide. HTTP/1.1 offers it where the writer is the connection's own write buffer, in cleartext or with kernel TLS: a static file is read off the ring straight into that buffer after the headers, 12 KiB per flush, with no AssetReader and no copy. TLS in BoringSSL, HTTP/2 and HTTP/3 keep the AssetReader path. - Certificate rotation: with ioxide 0.26 the reactors started with one TlsOptions share its contexts, so ReloadCertificates rotates each port through one service. One call per reactor only built the same set again. - Docs: SendTimeoutMs is also the listener's TCP_USER_TIMEOUT, and TxKernelTls fails the start without the kernel's tls module.
…nization opts a connection out A connection written from several threads, as the reactive flavour exists for, raced the pong and close frames the default OnPing and OnClose handlers write from the message pump, which no lock of the application's covers. On ioxide that corrupts the connection's buffer. An uncontended SemaphoreSlim.WaitAsync completes synchronously, so serializing is the default now; a connection only one thread ever writes can opt out. (#959)
A task started from OnConnected, a broadcaster or a timer, still held the connection after the client had gone and the pump had returned, and its writes still went to the response sink of a connection the engine was done with. On ioxide, whose connections are pooled, they landed in the stream of the client that took its place. DisposeAsync now marks the connection closed under the write lock, so a write in flight finishes first, and every later write throws ConnectionClosedException, which a background writer should stop on. (#959)
Each sample with a TCP listener sets ReadTimeoutMs and SendTimeoutMs to a minute, both off by default in the engine: a client that sends nothing is let go, and so is one that stops reading. Http3Sample binds no TCP listener; its QUIC read timeout was set already, and QUIC has no flush timeout of its own.
MDA2AV
force-pushed
the
update-ioxide-0.20.396
branch
from
November 11, 2026 19:53
cfb9612 to
a5d6314
Compare
MDA2AV
marked this pull request as ready for review
November 12, 2026 11:19
This was referenced Nov 13, 2026
MDA2AV
marked this pull request as draft
November 13, 2026 19:17
…Frame from splitting messages - A frame with a reserved bit set, a close frame with a one-byte payload or a status code that may not be sent, and a close reason or text message that is not valid UTF-8 are reported as errors, as are a continuation frame with no message to continue and a new message started inside a fragmented one (new FrameErrorType values). - FrameError.CloseStatus gives the status code to close the connection with for an error. - TryReadFrame leaves a fragmented message, and one interrupted by a control frame, to ReadFrameAsync, which reassembles it. It returned the fragments one by one before, and a message interrupted by a ping lost its final fragment. - MaxFrameSize(int) on the websocket builders sets the largest frame payload a client may send (16 KiB, as before).
…ast it ChunkedFraming.CopyChunk read the length of the chunk it had copied after handing the reader's buffer back with AdvanceTo. A ReadOnlySequence computes its length from its segments, and a reader may reset and reuse those once advanced past: a chunk starting in a later segment of the buffer then reported a wrong length, larger than the buffer it was copied into. Over the ioxide engine's TLS connections this cut an echoed chunked body short and faulted the connection.
…its buffers, and over TLS - RecyclingPipeReader serves a body a few segments at a time and overwrites, resets and unlinks every segment it is advanced past, so a framing that still touches memory it handed back fails instead of getting away with it. ChunkedFraming and ContentLengthFraming read 256 KiB through it across segment and read sizes, read 4 MiB to the end, and skip 1 MiB unread. - StreamBodyTests: a megabyte in chunks of uneven sizes, streamed straight back while it is still being read, on every engine. - TlsBodyTests (ioxide): bodies streamed back over TLS, chunked over HTTP/1.1 and with a Content-Length over HTTP/2, 64 KiB to 1 MiB, five times each. Without the fix of 28b0cd1, TestChunkedBodiesOverHttp1, the chunked TestLargeBodyFromRecyclingReader and TestReadWholeChunkStartingInLaterSegment fail.
MDA2AV
added a commit
to MDA2AV/HttpArena
that referenced
this pull request
Nov 16, 2026
…t/GenHTTP#953 (#1783) * genhttp-ioxide: build GenHTTP from the branch of Kaliumhexacyanoferrat/GenHTTP#953 GenHTTP is cloned at e3974794, the head of #953, and referenced as projects rather than the 11.3.0 packages; the commit is pinned because the bench box builds on cached layers. ioxide.pg and ioxide.timer move to 0.26.563 with the branch's ioxide. The echo handler closes a rejected frame with FrameError.CloseStatus, and frames of up to 64 KiB are accepted (MaxFrameSize). * genhttp-ioxide: pin GenHTTP to 28b0cd10, which fixes chunked request bodies over TLS
MDA2AV
added a commit
to MDA2AV/HttpArena
that referenced
this pull request
Nov 16, 2026
…nHTTP#953 5967f5c6b, one commit past 28b0cd107. It adds acceptance tests only: Engine/Ioxide and the modules this entry builds are unchanged, and still on ioxide 0.26.563.
All five ioxide packages move from 0.26.563 to 0.27.637. The release closes MDA2AV/ioxide#566 to #573, which were filed from this pull request's review: a file read under WriteOverflow=Segmented no longer goes out ahead of the head written before it, HTTP/2 checks a request's content-length against its DATA and grows its connection window, a stream that ends early stops the client's upload, a TLS flush after the reactor stopped returns, a failed reactor start gives back its ring, and the HTTP/2 and HTTP/3 stacks gain a request body flag, ResetStreamAsync and OnHandlerFault. The engine builds against it unchanged; the commits after this one adopt the new APIs.
…rver's logging instead of ioxide's stderr
A response that failed after its head was ended by rethrowing, the only way
ioxide used to have to reset a stream. ioxide then printed the fault to
stderr too, so every such fault was reported twice, and the second report
could be neither routed nor silenced. The shared streamed dispatch now ends
the stream with the writers' ResetStreamAsync from ioxide 0.27, which sends
the INTERNAL_ERROR (HTTP/2) or H3_INTERNAL_ERROR (HTTP/3) the rethrow did.
What ioxide still catches itself, a fault in the dispatch's own error path or
the stack failing to finish a response once its handler has returned, goes
to OnHandlerFault, which logs it through the server's logging as "Failed to
complete {Protocol} request". HTTP/2 connections share one Http2Options,
built with the server. (#984)
StreamedResponseEndTests: the reset tests assert that the fault does not
reach stderr, and TestFaultReachingIoxideIsLoggedOverHttp2/3 have a log sink
refuse the dispatch's own report, so the fault escapes to ioxide and has to
arrive in the server's logging instead. Without the change, the reset tests
and the two new ones fail.
… the handler A stream counted as having a body only when it carried a content-length, which neither protocol requires. A body of unknown length, as HttpClient streams one it cannot measure and fetch sends one from a ReadableStream, arrives without it, so the handler was given no body at all. StreamedRequest now takes the request body flag ioxide 0.27 reads off the HEADERS, and still counts a content-length, so an empty body announced by one stays a body, as it is over HTTP/1.1. StreamedRequestBodyTests.TestBodyOfUnknownLengthIsRead echoes a body sent without a content-length over HTTP/2, and Http3Tests.TestHttp3StreamsTheRequestBody now sends its body that way. Both fail without the change.
This branch has not been deployed
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.
Bumps all six
ioxidepackage references from0.15.251to0.27.637, adapts the engine to each release, and fixes ten open issues against the engine and the websockets module. One commit per area, plus two for the Sonar findings. Rebased onto main, whose ownExpect: 100-continuehandling (#965) replaces the branch's (#928, moved to #958 before), so its two commits are gone, and so is the compliance concern fix made on top of them.ioxide 0.16 to 0.20 (#929, #917)
IdleTimeoutMsisReadTimeoutMson both transports now, and it means something else: the clock only runs while the server waits on its client. A slow handler keeps its connection; an idle keep-alive connection or a silent websocket does not. The engine's own option follows, asReadTimeoutMsonTcpTransportOptionsandQuicTransportOptions, and the oldIdleTimeoutMsis gone, with no alias. The docs are rewritten for the new meaning - including HTTP/2, whose frame loop keeps a read parked while handlers work, so there a response slower than the timeout is still cut.SendTimeoutMsis a deadline for one flush now rather than for the whole response; documented.shutdown(2)calls and theirLibraryImportare gone.DecRefsends the FIN itself, after any send still in flight, and never on a descriptor the reactor has already closed.RecvQueueEntriesdefault of 64 in 0.17.340, which is what the engine uses.ioxide 0.21 to 0.26.563 (#971, #975)
RunAsync, whose handler takes the body reader, so a request's body reaches the handler as it arrives instead of being assembled first.SynchronizationContext, so a handler that awaits something other than ioxide comes back on the thread that completed it, where the response and the thread-statics it reads (IoxideReactor.Current, the request pools) don't belong. Both drivers takeReactor.Currentwhen they start and await aReactorSwitchright after the handler. On the reactor, the usual case, that's one thread check.IIoxideFileSinkinGenHTTP.Api.Ioxide, which the HTTP/1.1 sink offers where the writer is the connection's own write buffer: in cleartext, or with kernel TLS.IoxideAssetContentthen reads the file off the ring straight into that buffer after the headers, 12 KiB per flush, with noAssetReaderand no copy. TLS in BoringSSL, HTTP/2 and HTTP/3 keep theAssetReaderpath.TlsOptionsper port, and since 0.26 the reactors started with oneTlsOptionsshare its contexts. So a session ticket resumes on any reactor of the port, andReloadCertificatesrotates each port through one service. One call per reactor only built the same set again, which 0.26 keeps until the stop.SendTimeoutMsis also the listener'sTCP_USER_TIMEOUTsince 0.26, andTxKernelTlsfails the start without the kernel'stlsmodule rather than every connection after its handshake.ioxide 0.27.637 (#984)
0.27 closes the ioxide issues filed from this pull request's review, MDA2AV/ioxide#566 to MDA2AV/ioxide#573. The engine builds against it unchanged, and takes up three of its additions:
ResetStreamAsync(), which sends the sameINTERNAL_ERROR/H3_INTERNAL_ERROR, and the fault is logged once, by the engine.OnHandlerFaultis set for both protocols, so a fault ioxide catches itself, one in the dispatch's own error path or the stack failing to finish a response, is logged as "Failed to complete {Protocol} request" instead of being printed. HTTP/2 connections share oneHttp2Options, built with the server.content-length, which neither HTTP/2 nor HTTP/3 requires, so a body of unknown length (HttpClientstreaming one it cannot measure,fetchsending aReadableStream) reached the handler as no body at all. The engine now takes the body flag ioxide reads off the HEADERS, and still counts acontent-length, so an empty body announced by one stays a body, as over HTTP/1.1.WriteOverflow = Segmented, a static file read through the HTTP/1.1 file sink no longer goes out ahead of its head (tcp: ReadFileAsync reads into the primary slab while a response has spilled into Segmented overflow, so the file's bytes go out ahead of the head MDA2AV/ioxide#566). Nothing changes on this side for it.HTTP/2 and HTTP/3 streamed responses (#930, #932)
FlushAsyncreturns aFlushResultnow.StreamedSinkthrowsConnectionClosedExceptionon a completed flush, asHttp1WriterStreamalready does, so a server-sent event source over h2 or h3 seesConnectedturn false and stops when its client leaves (Ioxide engine: server-sent events over HTTP/2 and HTTP/3 never notice that the client left #932).INTERNAL_ERROR/H3_INTERNAL_ERROR) instead of ending a truncated body as if it were whole; since 0.27 through the writers'ResetStreamAsync, see below. Before the headers it is still a 500 (Ioxide engine: a response that fails mid-body ends cleanly over HTTP/2 and HTTP/3, so the client gets a truncated body as complete #930). A client that left mid-response ends quietly rather than as a logged error.StreamedDriver.DispatchAsyncnow, driven through a smallIStreamedWriteradapter per protocol; each driver keeps only the mapping of its own request.Reactor start (#933)
Reactor.OnFaultis set. A reactor that cannot start - a ring the kernel refuses, a port already taken, a throw fromOnStart- failsStartAsyncwith its reason, and the reactors that did start are stopped again instead of serving one short. Every reactor is constructed before any thread starts, so a configuration ioxide refuses fails before anything runs. A reactor that faults after it started is logged as critical; one that fails while the start is failing already is logged at debug, so a taken port does not produce a critical line per core.Websocket writes (#914, #959)
OnPingandOnClosehandlers send from the message pump, which an application's own lock never covers.DisableWriteSynchronization()on the builders opts out, for a connection only one thread ever writes. An uncontendedSemaphoreSlim.WaitAsynccompletes synchronously, so the default costs next to nothing.DisposeAsyncmarks the connection closed under the write lock, so a write in flight finishes first, and every later write throwsConnectionClosedException, which a background writer started fromOnConnectedshould stop on. The docs onISocketConnectionsay so.On the ioxide engine both matter for more than garbled frames. With four writers and no lock the test host crashed with native memory corruption in 2 of 16 runs, and in none of 16 with the writes serialized. And ioxide pools its connections: on one reactor, a late write to a closed connection landed in the stream of the client that took its place, in 3 of 3 runs, and is refused with this change.
Websocket protocol checks
Autobahn's fuzzing client failed 111 of its 244 cases against the imperative echo handler HTTP Arena runs. Apart from the frame size, each failure was a rule of RFC 6455 the reader did not check. The reader now reports them as error frames, with new
FrameErrorTypevalues, andFrameError.CloseStatusgives the status code to close the connection with:InvalidReservedBitsInvalidContinuationInvalidCloseFrameInvalidUtf8TryReadFramereturned the frames of a fragmented message one at a time. A message interrupted by a ping also lost its final fragment:TryReadFramereturned that fragment on its own, and the nextReadFrameAsyncwaited for it.TryReadFramenow leaves both cases toReadFrameAsync, which reassembles the message. It does not decode those frames itself, because decoding unmasks the payload in place.MaxFrameSize(int)on the websocket builders sets the largest payload a frame may carry. The default stays 16 KiB, the limit the connection had hard-coded.What users will notice: a client that breaks one of these rules now gets an error frame where its data used to be passed on. The new
FrameErrorTypevalues come after the existing ones, so their numbers do not change. In manual continuation mode, checking that a fragmented text message is valid UTF-8 is up to the handler (documented onHandleContinuationFramesManually); unfragmented text messages are still checked.Hot path:
Frame.Decodenow runsUtf8.IsValid(vectorized) over every unfragmented text frame. Binary and control frames are unaffected.Benchmarks/has no websocket benchmark, so the cost is not measured here.Chunked request bodies
ChunkedFraming.CopyChunkread the length of the chunk it had just copied after advancing the reader past it. AReadOnlySequencecomputes its length from its segments, and a reader may reset those once they are handed back, so a chunk that started in a later segment of the buffer could report a length larger than the buffer it was copied into. Over the ioxide engine's TLS connections, this cut chunked bodies short: an echoed 64 KiB chunked body came back 12 bytes short in 18 runs out of 20, and the connection faulted. The length is now taken first. The bug came with the body consolidation of #964, so 11.2.0 and 11.3.0 have it too, but there it stayed latent: with ioxide 0.15.251 the same requests over TLS never hit it (0 of 60). It showed with this branch's ioxide update, whose TLS reader fills its buffer differently.ChunkedFramingTests.TestReadWholeChunkStartingInLaterSegmentreproduces it with a plainPipe, so any engine can meet it when a chunk starts in a later segment of the buffer.Samples
The ioxide samples with a TCP listener set both
ReadTimeoutMsandSendTimeoutMs, a minute each, so they show both clocks: a client that sends nothing is let go, and so is one that stops reading. Both stay off by default in the engine.Http3Samplebinds no TCP listener; it already set QUIC's read timeout, and QUIC has no flush timeout of its own.Verification
StreamedResponseEndTests,ReactorStartupTests,ReadTimeoutTests,SynchronizedWriteTests,Http3Tests(a request body streamed over HTTP/3),ReactorReturnTests(HTTP/1.1 and HTTP/2),CertificateTests(20 connections over 4 reactors after a rotation) andLateWriteTests(all three engines, plus the reused ioxide connection). Each was run with its fix disabled and fails without it, apart from the pre-header 500 case, which is a control.TryReadFrametests fail without the fix. Autobahn (cases 1-7 and 10) against the HTTP Arena genhttp-ioxide entry built from this branch: 238 of 244, up from 133 with 11.3.0. The six left are the 64 KiB frames, above the 16 KiB default.RecyclingPipeReaderoverwrites and resets every segment it is advanced past, so a framing that reads released memory fails deterministically. Without the chunked fix,TlsBodyTests.TestChunkedBodiesOverHttp1(ioxide, TLS), the chunkedTestLargeBodyFromRecyclingReaderandTestReadWholeChunkStartingInLaterSegmentfail.TestFaultReachingIoxideIsLoggedOverHttp2/3, the reset tests' stderr check,TestBodyOfUnknownLengthIsReadandTestHttp3StreamsTheRequestBody, which now sends its body without a content-length, each fail without their fix.Follow-ups
DisableWriteSynchronization, and the timeout guidance for websockets.TcpOptions.AddressandQuicOptions.Addressmake that fixable.ICertificateValidator.Validatecould run over HTTP/3 as well; until then the startup warning still applies.Closes #914, closes #917, closes #929, closes #930, closes #932, closes #933, closes #959, closes #971, closes #975, closes #984