Skip to content
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

connectTCP is leaking filedescriptors on timeout #331

Closed
tchaloupka opened this issue May 11, 2021 · 1 comment · Fixed by #332
Closed

connectTCP is leaking filedescriptors on timeout #331

tchaloupka opened this issue May 11, 2021 · 1 comment · Fixed by #332

Comments

@tchaloupka
Copy link
Contributor

Similar to #115 but in this case it's about connection timeouts.
Tested on linux.

Test case:

#!/usr/bin/env dub
/  dub.sdl:
name "test"
dependency "eventcore" version="0.9.13"
dependency "vibe-core" version="1.16.0"
 /

import core.time;
import vibe.core.core;
import vibe.core.log;
import vibe.core.net;
import std.stdio;

void main()
{
        foreach (_; 0 .. 20) {
                TCPConnection conn;
                try conn = connectTCP("192.168.0.152", 1234, null, 0, 1.seconds); // some ip:port that would cause connection timeout
                catch (Exception e) logError(e.msg);
        }
        readln();
}

I had a suspicion about this line as it causes that eventDriver.sockets.releaseRef(sock) is not called.
But tried it locally and it still leaks.
So I'd suspect this method as it only set state and not closing the socket?

@s-ludwig s-ludwig transferred this issue from vibe-d/vibe-core Jan 21, 2023
@s-ludwig s-ludwig transferred this issue from vibe-d/eventcore Jan 21, 2023
@s-ludwig
Copy link
Member

I was a bit too quick with moving this to eventcode and had to move it back, since this turned out to be a simple issue in vibe-core itself. Will post a PR shortly.

s-ludwig added a commit that referenced this issue Jan 21, 2023
gedaiu pushed a commit to gedaiu/vibe-core that referenced this issue May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants