Skip to content

Ioxide engine: reset a response that fails after its head with ResetStreamAsync, so the fault is no longer also written to stderr #984

Open

Description

@MDA2AV

MDA2AV/ioxide#579 (for MDA2AV/ioxide#572), not merged yet, gives ioxide's HTTP/2 and HTTP/3 response writers an ResetStreamAsync, which resets the stream without the handler throwing, and adds OnHandlerFault to Http2Options and Nghttp3Options. This issue is to adopt them once an ioxide release carries it.

Today

In #953, StreamedDriver.DispatchAsync (Engine/Ioxide/Protocol/Drivers/StreamedDriver.cs) handles a fault after the response head by logging it through server.Logging and rethrowing, since throwing is the only way to have ioxide reset the stream:

if (headersWritten)
{
    throw;
}

ioxide catches the rethrow, resets the stream, and writes its own line to stderr ([ioxide.http2] request handler faulted: ..., [ioxide.nghttp3] request handler faulted: ...). So every such fault is reported twice, and the second report can't be routed or silenced.

Change

  1. IStreamedWriter gets ValueTask ResetStreamAsync(). The HTTP/2 and HTTP/3 Writer structs implement it as writer.ResetStreamAsync(), whose default codes, INTERNAL_ERROR and H3_INTERNAL_ERROR, are the ones the rethrow gets today.
  2. StreamedDriver.DispatchAsync calls await writer.ResetStreamAsync(); where it rethrows now. The client sees the same reset, and the fault is logged once, by the engine.
  3. Optional: OnHandlerFault sends what still reaches ioxide to server.Logging: an exception thrown by the catch's own 500 path, or ioxide failing to finish a response after the handler returned. HTTP/2 needs an Http2Options built once and passed in Http2Driver.RunAsync, which creates Http2Connection(pipe) without options today. HTTP/3 adds it to _h3Options in Server.Quic.cs.

Without these changes nothing breaks: the rethrow still resets the stream, as it does now.

Blocked on an ioxide release with MDA2AV/ioxide#579. Related: #953.

Activity

  1. self-assigned this
    on Nov 14, 2026
  2. changed the title [-]Ioxide engine: reset a response that fails after its head with AbortAsync, so the fault is no longer also written to stderr[/-] [+]Ioxide engine: reset a response that fails after its head with ResetStreamAsync, so the fault is no longer also written to stderr[/+] on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions