Skip to content

Fix uncatchable IO exceptions. - #1137

Closed
mefyl wants to merge 6 commits into
mirage:mainfrom
mefyl:main
Closed

Fix uncatchable IO exceptions.#1137
mefyl wants to merge 6 commits into
mirage:mainfrom
mefyl:main

Conversation

@mefyl

@mefyl mefyl commented Dec 23, 2025

Copy link
Copy Markdown
Contributor

There is currently a bug where IO write exception are "uncatchable": even if the underlying IO_error is handled, it would still find its way out and kill the main loop as demonstrated in this test.

Bamboozled by the backtrace, I initially reported this in lwt and lived with it for some time. I finally had enough and jumped into the rabbit hole, copiously hitting my head every meter during the fall, but finally hunted it down to this Lwt.dont_wait. Cruel irony, I already addressed this very issue but was too shy. This is the harsher version, which I think is the correct one:

  • No exception escaping res should be reported twice.
  • AFAICT the only other thing that could raise is Connection.close, but I don't think any exception there should kill the Lwt loop either.

@mefyl mefyl changed the title Main Fix uncatchable IO exceptions. Dec 23, 2025
Benjamin Nguyen-Van-Yen and others added 2 commits May 6, 2026 15:58
RFC 7230 §3.3.1 forbids Transfer-Encoding in 1xx, 204, and 304 responses.
The previous cohttp 6.x change that defaulted Unknown encoding to Chunked
did not account for these response types, causing e.g. WebSocket 101
Switching Protocols responses to include a spurious Transfer-Encoding: chunked
header and a trailing chunked body terminator (0\r\n\r\n), breaking the
WebSocket handshake for conforming clients.
…ncoding-v2

fix: don't add Transfer-Encoding to responses that cannot have a body
@mefyl

mefyl commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #1140

@mefyl mefyl closed this Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant