-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better handling of IO errors #669
Merged
Merged
Conversation
This file contains 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
Before, if the client closed the connection while we were handling a request, the server would crash. Now, we just log this at `info` level and continue.
avsm
reviewed
Jul 18, 2019
Tested on github and rwo's regression tests also -- thanks for this fix! |
avsm
added a commit
to avsm/opam-repository
that referenced
this pull request
Jul 20, 2019
…ohttp-top, cohttp-async and cohttp-mirage (2.2.0) CHANGES: - Previously if the client closed the connection while cohttp was handling a request, the server would crash (by default, unless the user overrode that using `on_exn` or changing Lwt's async exception handler). Now, cohttp will just log this at `info` level and continue. Exceptions produced by user code are logged as errors, while other exceptions generated by cohttp call back to the conduit exception handler, as before. (mirage/ocaml-cohttp#669 @talex5)
Thank you for this! I think this makes #645 even more important, so these log messages can be controlled separately by the application. |
craigfe
added a commit
to craigfe/irmin
that referenced
this pull request
Jul 26, 2019
Cohttp server creation now allows passing of an exception handler, fixing a previous issue where the server would crash on a user-raised exception. See: mirage/ocaml-cohttp#669
craigfe
added a commit
to craigfe/irmin
that referenced
this pull request
Jul 26, 2019
Cohttp server creation now allows passing of an exception handler, fixing a previous issue where the server would crash on a user-raised exception. See: mirage/ocaml-cohttp#669
kit-ty-kate
added a commit
to kit-ty-kate/mirage-ci
that referenced
this pull request
Jun 24, 2020
kit-ty-kate
added a commit
to kit-ty-kate/mirage-ci
that referenced
this pull request
Jun 24, 2020
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.
Before, if the client closed the connection while we were handling a request, the server would crash (by default, unless the user overrode that using
on_exn
or changingLwt
's async exception handler). Now, we just log this atinfo
level and continue. Exceptions produced by user code are logged as errors, while other exceptions generated by cohttp call back to the conduit exception handler, as before.Fixes #511.
I first tried getting the IO operations to return a
result
and plumbing that through everywhere, but it was very painful and caused lots of API changes. So instead, each IO monad is now expected to include handling of IO errors, and provides acatch
operation to expose it. This avoids changes to the core of cohttp. The lwt-unix and mirage implementations both make use ofLwt.fail
to carry IO errors.This PR adds a unit-test to check that the server doesn't crash if the client closes the connection. It also adds checks to some other tests to ensure that no errors or warnings were logged during the test.