-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
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:
let connect ~sw ~env addr =
ignore @@ Eio.Net.connect ~sw env#net addr
let print addr =
Format.printf "@[%a@]@." Eio.Net.Sockaddr.pp addr
let connect_and_print ~sw ~env addr =
print addr;
(match addr with | `Tcp (a,_) -> Eio.Net.Ipaddr.fold ~v4:(fun _ -> connect ~sw ~env addr) ~v6:(fun _ -> ()) a | _ -> ())
let getaddrinfo ~sw ~env uri =
List.iter (connect_and_print ~sw ~env) @@
Eio.Net.getaddrinfo_stream ~service:"http" env#net
(Uri.host_with_default uri)
let google_uri = Uri.of_string "http://google.com"
let rec loop ~sw ~env clock count =
Format.printf "%d:@." count;
getaddrinfo ~sw ~env google_uri ;
loop ~sw ~env clock @@ (count + 1)
let () =
Eio_main.run @@ fun env ->
Eio.Switch.run @@ fun sw ->
let clock = env#clock in
loop ~sw ~env clock 0
This initially given the correct output
0:
tcp:142.250.186.206:80
tcp:[2a00:1450:401b:80d::200e]:80
1:
tcp:142.250.186.206:80
tcp:[2a00:1450:401b:80d::200e]:80
But after 1019 requests Eio.Net.getaddrinfo_stream
returns no addresses:
1018:
tcp:142.250.186.206:80
tcp:[2a00:1450:401b:80d::200e]:80
1019:
1020:
1021:
1022:
1023:
1024:
1025:
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
Metadata
Metadata
Assignees
Labels
No labels