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

Basic example creates zombie on Mac OS #2596

Closed
Geod24 opened this issue Aug 24, 2021 · 0 comments · Fixed by vibe-d/vibe-core#292
Closed

Basic example creates zombie on Mac OS #2596

Geod24 opened this issue Aug 24, 2021 · 0 comments · Fixed by vibe-d/vibe-core#292
Labels

Comments

@Geod24
Copy link
Contributor

Geod24 commented Aug 24, 2021

Using Mac OS 11.5.2, but I believe this triggers on OSX too.

% mkdir test && cd test
% dub init -t vibe.d -n .
Successfully created an empty project in '/Users/geod24/projects/bpfk/agora/test'.
Package successfully created in .
% dub
Running pre-generate commands for vibe-d:tls...
Performing "debug" build using dmd for x86_64.
taggedalgebraic 0.11.22: target for configuration "library" is up to date.
eventcore 0.9.17: target for configuration "cfrunloop" is up to date.
stdx-allocator 2.77.5: target for configuration "library" is up to date.
vibe-core 1.19.0: target for configuration "cfrunloop" is up to date.
vibe-d:utils 0.9.3: target for configuration "library" is up to date.
vibe-d:data 0.9.3: target for configuration "library" is up to date.
mir-linux-kernel 1.0.1: target for configuration "library" is up to date.
vibe-d:crypto 0.9.3: target for configuration "library" is up to date.
diet-ng 1.8.0: target for configuration "library" is up to date.
vibe-d:stream 0.9.3: target for configuration "library" is up to date.
vibe-d:textfilter 0.9.3: target for configuration "library" is up to date.
vibe-d:inet 0.9.3: target for configuration "library" is up to date.
vibe-d:tls 0.9.3: target for configuration "openssl" is up to date.
vibe-d:http 0.9.3: target for configuration "library" is up to date.
vibe-d:mail 0.9.3: target for configuration "library" is up to date.
vibe-d:mongodb 0.9.3: target for configuration "library" is up to date.
vibe-d:redis 0.9.3: target for configuration "library" is up to date.
vibe-d:web 0.9.3: target for configuration "library" is up to date.
vibe-d 0.9.3: target for configuration "vibe-core" is up to date.
test ~master: building configuration "application"...
Linking...
To force a rebuild of up-to-date targets, run again with --force.
Running test
[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.
^C[main(----) INF] Received signal 2. Shutting down.

% ps aux | grep test
geod24           15024   0.0  0.0  4268448    744 s006  S+   12:04PM   0:00.00 grep --color=auto test
geod24           14999   0.0  0.1  4444224   9812 s006  S    12:03PM   0:00.02 /Users/geod24/projects/bpfk/agora/test/test
% lldb -p 14999
(lldb) process attach --pid 14999
Process 14999 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff203572ba libsystem_kernel.dylib`mach_msg_trap + 10
libsystem_kernel.dylib`mach_msg_trap:
->  0x7fff203572ba <+10>: retq
    0x7fff203572bb <+11>: nop

libsystem_kernel.dylib`mach_msg_overwrite_trap:
    0x7fff203572bc <+0>:  movq   %rcx, %r10
    0x7fff203572bf <+3>:  movl   $0x1000020, %eax          ; imm = 0x1000020
Target 0: (test) stopped.

Executable module set to "/Users/geod24/projects/bpfk/agora/test/test".
Architecture set to: x86_64h-apple-macosx-.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff203572ba libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x00007fff2035762c libsystem_kernel.dylib`mach_msg + 60
    frame #2: 0x00007fff20485b2f CoreFoundation`__CFRunLoopServiceMachPort + 316
    frame #3: 0x00007fff2048420f CoreFoundation`__CFRunLoopRun + 1328
    frame #4: 0x00007fff2048361c CoreFoundation`CFRunLoopRunSpecific + 563
    frame #5: 0x000000010c67580a test`_D9eventcore7drivers5posix9cfrunloop18CFRunLoopEventLoop15doProcessEventsMFNbNeS4core4time8DurationZb + 202
    frame #6: 0x000000010c6777f1 test`_D9eventcore7drivers5posix6driver__T20PosixEventDriverCoreHTCQChQCaQBv9cfrunloop18CFRunLoopEventLoopHTCQDxQDq5timer22LoopTimeoutTimerDriverHTCQFkQFdQEy6events__T22PosixEventDriverEventsHTQExHTCQHjQHcQGx7sockets__T23PosixEventDriverSocketsHTQGyZQBfZQDjHTCQJsQJlQJg9processes__T25PosixEventDriverProcessesHTQJlZQBhZQKr13processEventsMFNbNfS4core4time8DurationZEQNtQMy10ExitReason + 253
    frame #7: 0x000000010c660d6b test`_D4vibe4core4task13TaskScheduler14waitAndProcessMFNbNfZE9eventcore6driver10ExitReason + 159
    frame #8: 0x000000010c63389e test`_D4vibe4coreQf12runEventLoopFNbNfZi + 294
    frame #9: 0x000000010c6336c6 test`_D4vibe4coreQf14runApplicationFNfPAAyaZi + 286
    frame #10: 0x000000010c3b6ba0 test`_Dmain at app.d:15
    frame #11: 0x000000010c72737b test`_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZ9__lambda2MFZv + 31
    frame #12: 0x000000010c72721d test`_D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv + 33
    frame #13: 0x000000010c7272f7 test`_D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv + 139
    frame #14: 0x000000010c72721d test`_D2rt6dmain212_d_run_main2UAAamPUQgZiZ7tryExecMFMDFZvZv + 33
    frame #15: 0x000000010c72717a test`_d_run_main2 + 654
    frame #16: 0x000000010c726ed6 test`_d_run_main + 202
    frame #17: 0x000000010c3b6bfe test`main(argc=1, argv=0x00007ffee384b768) at entrypoint.d:29
    frame #18: 0x00007fff203a7f3d libdyld.dylib`start + 1
    frame #19: 0x00007fff203a7f3d libdyld.dylib`start + 1

As you can see, the most simple app creates a zombie. This is not visible to the user thanks to SO_REUSEPORT, but became a major annoyance when I created an UDP server which didn't have the option on by default.
Using Ctrl+\ is a workaround, but it bypasses the normal shutdown of the app.

Using dub / ldc packaged with Homebrew:

% ldc2 --version
LDC - the LLVM D compiler (1.27.1):
  based on DMD v2.097.2 and LLVM 12.0.1
  built with LDC - the LLVM D compiler (1.27.1)
  Default target: x86_64-apple-darwin20.6.0
  Host CPU: skylake
  http://dlang.org - http://wiki.dlang.org/LDC
% dub --version
DUB version 1.26.1, built on Jul 20 2021
@Geod24 Geod24 added the bug label Aug 24, 2021
s-ludwig pushed a commit to vibe-d/vibe-core that referenced this issue Aug 24, 2021
Ensures that the thread local event loop gets terminated, even if it is currently in an infinite wait state.

Fixed vibe-d/vibe.d#2596
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant