Skip to content

Ioxide engine: adapt to the next ioxide release (IdleTimeoutMs rename, drop the raw shutdown calls) #929

Description

@MDA2AV

The ioxide engine pins ioxide 0.14.239. The first ioxide release after 0.15.251 will include MDA2AV/ioxide#246, which needs a few changes here. Checked by building Engine/Ioxide against ioxide's current main.

1. Build break: IdleTimeoutMs was renamed to ReadTimeoutMs

ioxide#246 renamed the option on both transports. These are the only two compile errors:

  • Engine/Ioxide/Infrastructure/Server.Tcp.cs:35: TcpOptions.IdleTimeoutMs → ReadTimeoutMs
  • Engine/Ioxide/Infrastructure/Server.Quic.cs:88: QuicOptions.IdleTimeoutMs → ReadTimeoutMs

With both renamed, the engine builds against ioxide main on net10.0 and net11.0.

The meaning changed too, so the doc on TcpTransportOptions.IdleTimeoutMs in EngineOptions.cs should change, and possibly its name:

  • Before: close a connection that has neither received nor sent anything for this long.
  • Now: the clock only runs while the connection is waiting on its client, with a read parked and nothing being sent. The server's own sends restart it, and time the handler spends working does not count. A slow handler no longer gets its connection cut; an idle keep-alive or websocket still does.
  • The websocket advice there still holds: set it above the ping interval. A ping from either side restarts the clock.
  • QUIC works the same way: the clock only runs while the client owes the next move, and ioxide pings to keep the connection alive while a response is still being produced.

2. Delete the raw shutdown(2) calls

TcpDriver.cs:52 and TcpDriver.cs:181 call shutdown(conn.ClientFd, SHUT_WR) through a LibraryImport, and each is followed by conn.DecRef(). Since ioxide#246, DecRef() sends that FIN itself. It waits for any send still in flight, and never targets an fd the reactor has already closed. So both calls and the LibraryImport can simply go.

The raw call is also the riskier version:

  • ClientFd isn't the engine's to shut down. After a reactor teardown that number can belong to another socket.
  • A FIN while a send is still in flight cuts the response short.

If the engine ever needs a FIN while keeping the connection (Connection: close with the handler still reading), MDA2AV/ioxide#262 adds TcpConnection.ShutdownWrite() for that. These two sites don't need it.

3. Optional: the RecvQueueEntries default

TcpTransportOptions.RecvQueueEntries defaults to 64 (EngineOptions.cs:56). At 64, a connection whose handler is slow to read can overflow its receive queue, and the reactor then drops data and closes the connection. MDA2AV/ioxide#257 (pending) raises ioxide's own default to 4096 and reports an overflow as an error rather than a clean EOF. Consider following ioxide's default.

Activity

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