On Tuesday, 5 January 2021 at 21:12:01 UTC, Selim Ozel wrote:
On Monday, 4 January 2021 at 17:17:10 UTC, Steven Schveighoffer wrote:
On 1/2/21 12:52 PM, Selim Ozel wrote:


After logging into to 127.0.0.1 for a single time in my browser, if I do a ctrl+c it still leaks two socket handles.

With connection Windows 10:
Running .\vibe_noleaks.exe
[main(----) INF] Listening for requests on http://[::1]:8080/
[main(----) INF] Listening for requests on http://127.0.0.1:8080/ [main(----) INF] Please open http://127.0.0.1:8080/ in your browser.
[00000000(----) INF] Received signal 2. Shutting down.
[main(----) INF] Stopped to listen for HTTP^ requests on C::1:8080
[main(----
) INFC:\Software\vibe_noLeaks>] Stopped to listen for HTTP requests on 127.0.0.1:8080
Warning: 2 socket handles leaked at driver shutdown.
Warning: 2 socket handles leaked at driver shutdown.

This is normal. The server uses keepalive connections, so that in case any more requests arrive on the same connection, the initial connection setup does not need to be established. Well, at least that is what I think is happening.

If you want a few seconds (I think 5 or so), then you won't get these.

It would be good if vibe-d could provide a way to shut down any keepalive connections when the server is shutting down.

-Steve

That's interesting. I actually started to dive deeper into those and tried to pinpoint the lines of code that result in additional open sockets upon new http connections; although my understanding of vibe-d is a bit too low at this point to figure out what's exactly happening.

I think from a user perspective having something a bit friendlier on warning side would be helpful.

Bausshf built a wrapper around vibe.d sockets called cheetah. Haven't used it myself but it looks more abstracted than than actual vibe.d code. Can't speak of the quality since I haven't used it myself.

Also it's got both a server and client abstraction but only the server example is shown. Still not low-level though.

https://github.com/bausshf/cheetah/wiki/Simple-Socket-Server-Example


I've used the very vibe.d example you referenced in the past and didn't have any trouble with it. So it could possibly be a bug or regression.

If you've have wsl2 installed on Windows, try running on the Linux side too.

Do you have any
suggestions in mind towards that? I have a bit of time this week and I could take a stab at it.

B


Reply via email to