vibe-d / vibe-core

Repository for the next generation of vibe.d's core package.
MIT License
61 stars 46 forks source link

Handle leaks are reported intermingled on app exit #224

Open tchaloupka opened 4 years ago

tchaloupka commented 4 years ago

Sample output for 4 threads:

[vibe-1(RfiZ) INF] Listening for requests on http://0.0.0.0:8080/
[vibe-3(MsfE) INF] Listening for requests on http://0.0.0.0:8080/
[vibe-2(kqJG) INF] Listening for requests on http://0.0.0.0:8080/
[vibe-0(q6Kw) INF] Listening for requests on http://0.0.0.0:8080/
^C[main(----) INF] Received signal 2. Shutting down.
WWarning (thread: vibe-2): lWarnieaking eventcore narWganin rdg (ri(nthread: ver becausthrvibe-0e e)itn: leakiaghndge (thread: vibe-1): vibe-3): leaki er:nve ge l naeeventcore raking eventctde sticroloirlrve e driver because therree activeb   eadhriver bceacanuadre stillse tlh eusere are sa there tceare stilitslli
 l acv   FateDctive handlei  s4
vh7ae  n  (dh streamListenlaF)es
n D
   FD 49 (streamListen)
22 (streamListen)
dles
   FD 25 (streamListen)
Warning (thread: vibe-2): leaking eventcore driver because theWarniWare are still acWarning (threang (thretadrive handle: vibe-3): leakidsnng i:
en  vgvibe-0 en) FD 47  t:(streamListen)
core (thread: vibe-1): leaking eventcore driver because there are still active handles
   FD 22 (streamListen)
 leaking eventcore driver driver because there are still active handles
   FD 25 (streamListen)
because there are still active handles
   FD 49 (streamListen)

Test code:

void main() {
    setupWorkerThreads(4);
    runWorkerTaskDist(&runServer);
    runApplication();
}

void runServer() {
    auto settings = new HTTPServerSettings;
    settings.options |= HTTPServerOption.reusePort;
    settings.bindAddresses = ["0.0.0.0"];
    settings.port = 8080;
    listenHTTP(settings, &handleRequest);
}

void handleRequest(scope HTTPServerRequest req, scope HTTPServerResponse res) {
        res.writeBody("Hello, World!", "text/plain");
}
ljmf00 commented 3 years ago

This is affecting https://github.com/TechEmpower/FrameworkBenchmarks and VibeHighEventPrioritytrick doesn't work with runWorkerTaskDist.