Socket handle leak and active handle warning with Vibe-D

Selim Ozel sozel at wpi.edu
Tue Jan 5 21:12:01 UTC 2021


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. 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.

Best,
S


More information about the Digitalmars-d-learn mailing list