Skip to content
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

cohttp-lwt: Don't leak asynchronous Retry exceptions. #992

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

- cohttp-lwt: Do not leak `Retry` exceptions to `Lwt.async_exception_hook`. (mefyl #992)

## v6.0.0~alpha2 (2023-07-1)
- http.header: introduce "iter_ord" to guarantee iteration following the order of the entries in the headers (mseri #986)
- http.header: fix "move_to_fist" and "first" ro follow Header's semantics (mseri #986)
Expand Down
7 changes: 5 additions & 2 deletions cohttp-lwt/src/connection_cache.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ end = struct
>>= fun connection ->
let res = Connection.call connection ?headers ?body meth uri in
(* this can be simplified when https://github.com/mirage/ocaml-conduit/pull/319 is released. *)
Lwt.async (fun () ->
Lwt.dont_wait (fun () ->
res >>= fun (_, body) ->
(match body with
| `Empty | `String _ | `Strings _ -> Lwt.return_unit
| `Stream stream -> Lwt_stream.closed stream)
>>= fun () ->
Connection.close connection;
Lwt.return_unit);
Lwt.return_unit)
(function
| Retry -> ()
| e -> raise e);
res
end

Expand Down