hannes changed the topic of #mirage to: MirageOS are OCaml unikernels - https://mirage.io - this channel is logged at http://irclog.whitequark.org/mirage/ - MirageOS 3.7.1 is released - happy hacking!
Hrundi_V_Bakshi has quit [Ping timeout: 250 seconds]
Haudegen has quit [Ping timeout: 256 seconds]
zofu_ has joined #mirage
zofu_ is now known as gozu
zofu has quit [Ping timeout: 250 seconds]
argent_smith has joined #mirage
hark has quit [Read error: Connection reset by peer]
tg has quit [Quit: Leaving]
jnavila has joined #mirage
aedc has joined #mirage
Haudegen has joined #mirage
aedc_ has joined #mirage
jnavila has quit [Ping timeout: 272 seconds]
mahmudov has quit [Read error: Connection reset by peer]
<argent_smith> hi ppl. I've got a problem: I try to make a connect -> r/w -> disconnect Lwt loop and my program leaks connections. what am i doing wrong? code example is here: https://gist.github.com/argent-smith/0fd6eb20acab72856b31dbab1c1849b1
<argent_smith> hannes ^^^
<hannes> argent_smith: you are calling TCPV4.disconnect -- I'd recommend to use "close" (described here https://github.com/mirage/mirage-flow/blob/master/src/mirage_flow.mli#L86)
<hannes> so, create_connection tcp dst >>= fun flow -> .. read/write flow >>= fun () -> .. close flow
<argent_smith> hannes i use both (ll 26, 27 of the gist)
<hannes> argent_smith: the connect () / disconnect () is part of the Mirage_device API (https://github.com/mirage/mirage-device) -- you should use the create_connection .. read/write .. close (mostly Mirage_flow API).
<hannes> how do you know / experience the leak? can you run it as unix process using the socket stack, and figure with ktrace (system call tracing) whether the open/socket call that creates a file descriptor is at the end of the communication being close()d?
<hannes> in your error handling (read/write) I fail to see any calls to close() <-- this may leak fd's
<hannes> and then the bizarre thing is in l25 -- so created a TCP connection (l18), send/recv some data (l23), then you sleep (l24) and call loop (l25) again -- when do you expect l26 (the TCP close) being executed?
<hannes> I'd suggest to move l26 just after the l23, before l24 -- i.e. once you send and received data, and no longer need the TCP flow
<hannes> (does this make sense?)
<argent_smith> ah, yes, l25 is not in its place!
<argent_smith> will fix it, thnx!
mahmudov has joined #mirage
<argent_smith> hannes fixed. thnx )
<argent_smith> also, I removed disconnect
<hannes> connect .. disconnect is about the lifetime of the tcp layer (and afaict, connect is only ever called once, mainly by code generated by mirage), and disconnect is some sort of overengineering for purposes not really clear to me
<hannes> i think at some point someone decided that when you boot a system, you also would like a clean shutdown... reality of mirageos is slightly different atm.. but good that your code is fixed now :)
<argent_smith> so, i use create_connection >>= ... >>= close flow. right?
<hannes> yes
mahmudov has quit [Remote host closed the connection]
mahmudov has joined #mirage
Hrundi_V_Bakshi has joined #mirage
jnavila has joined #mirage
argent_smith has quit [Quit: Textual IRC Client: www.textualapp.com]
jnavila_ has joined #mirage
jnavila has quit [Ping timeout: 256 seconds]
jnavila_ has quit [Ping timeout: 272 seconds]