-
Notifications
You must be signed in to change notification settings - Fork 71
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
Eio.Net.getaddrinfo_stream fails to resolve host after 1019 successful calls on linux #776
Comments
I think the problem is due to number of open connections. For example: let connect ~sw ~env addr =
let c = Eio.Net.connect ~sw env#net addr in
Eio.Flow.close c fixes this problem. Note with the use of the single switch these connections are never being closed (that may or may not be desired). Although I'm not quite sure why that is the case on Linux. But just thought I would send this comment to hopefully unblock you. |
Thanks, that's very helpful. But now I'm not sure, if this is eio issue, cohttp issue or am I supposed to close the connections manually? |
If you're using cohttp-eio, it will close the connection for you as soon as the switch goes out of scope. Just make sure you're not sharing a single switch for everything (like your example does) - see https://github.com/ocaml-multicore/eio?tab=readme-ov-file#switches-1. The behaviour of getaddrinfo ignoring the error and returning an empty list is questionable, but comes from OCaml's |
Oh, I am using a single switch everywhere :) |
@serpent7776 Switches are cheap, so don't hesitate to create more than one. |
I'm writing an application using cohttp-eio that repeatedly connects to a remote host every 3s. The initial 1019 requests succeed, but all the following requests fail to resolve the host. I can simplify the code to the following:
This initially given the correct output
But after 1019 requests
Eio.Net.getaddrinfo_stream
returns no addresses:I get the same behaviour every single time. I tested this on three different machines: Manjaro, Ubuntu and FreeBSD. It only reproduces on linux systems, so it's likely an issue in
eio_linux
.Also, it reproduces only when
Eio.Net.connect
is called.Possibly related #351
The text was updated successfully, but these errors were encountered: