hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Not sure Hyper.get and Hyper.post are closing the connection

Open craff opened this issue 1 year ago • 2 comments

Hello,

I observed a leak on file descriptors with a software using Hyper. Looking at the code, the body function does not seem to issue a Message.close, nor does the Hyper.get or Hyper.post.

I am investigating more, but put the issue in case you can confirm.

Cheers, Christophe

craff avatar Oct 02 '24 02:10 craff

I investigated more. Calling Message.close and/or using Hyper.request did not solve the problem. I think it is deeper in Dream and may be related to issue 347 of dream.

The observed behavior is that in general 5-10 unused sockets are preserved for some unknown reasons, but after a few days, this increase to more that 1000 sockets and the program fails with EMFILES as expected.

Switching to http-lwt-client immediatly solved the issue, so it must be an issue related to Hyper/Dream. Now no unused socket is kept.

Now that I have switched my code in production to http-lwt-client, I will not be able to investigate more. Sorry.

craff avatar Oct 13 '24 00:10 craff

Thanks for the endorsement, I'm glad http-lwt-client is useful for you. It was quite some work to get a non-fd-leaking HTTP client (we iterated several times over the codebase to find and fix leaks).

hannesm avatar Oct 14 '24 15:10 hannesm