-
Notifications
You must be signed in to change notification settings - Fork 8
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
File descriptor leak when using h2 #22
Comments
Looking at the code I don't see where the file descriptor is closed. So it may just be opam.robur.coop being more eager to close client connections. I will look more into it tomorrow. |
The socket is closed in http-lwt-client/src/http_lwt_unix.ml Lines 225 to 236 in b23065a
I wrote a crude test (that depends on brittle assumptions): https://github.com/reynir/http-lwt-client/tree/test-fd-leak What I discovered is that
|
In http-mirage-client, what we do is: let single_request
~ctx ~alpn_protocol ?config cfg ~meth ~headers ?body uri f f_init =
...
Mimic.resolve ctx >>? fun flow ->
(match .. with
| `HTTP2 -> single_h2_request
| _ -> single_http_1_1_request) >>= fun r ->
Mimic.close flow >>= fun () -> And so, the last line does an explicit close of the flow. With the same reasoning in mind, in http-lwt-client, we do a |
CHANGES: * Call shutdown in h2 to properly close http2 connections. This fixes a file descriptor leak reported in robur-coop/http-lwt-client#22 (robur-coop/http-lwt-client#23, @reynir @hannesm)
CHANGES: * Call shutdown in h2 to properly close http2 connections. This fixes a file descriptor leak reported in robur-coop/http-lwt-client#22 (robur-coop/http-lwt-client#23, @reynir @hannesm)
I have an application that queries on a regular interval an opam repository. Two instances run, one querying opam.ocaml.org and the other opam.robur.coop. The former is leaking file descriptors while the latter doesn't.
I need to verify, but running
curl -v https://opam.{ocaml.org,robur.coop}
curl at least uses h2 for opam.ocaml.org and http/1.1 for opam.robur.coop, and I suspect it is the same for http-lwt-client.The text was updated successfully, but these errors were encountered: