Bug 22222 – Custom unittest runner on phobos fails due to segfault on fork() exiting

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
Linux
Creation time
2021-08-19T00:59:11Z
Last change time
2021-08-19T04:23:52Z
Keywords
pull
Assigned to
No Owner
Creator
Luís Ferreira

Comments

Comment #0 by contact — 2021-08-19T00:59:11Z
This (https://github.com/dlang/phobos/blob/6bd92f053f564e3f20db137d11a2679320d9702e/std/stdio.d#L1659) `exit(0)` call from libc does an exit sequence before exit and therefore doesn't exit immediately. This causes some unittest runners on phobos to fail due to segfault on the exit sequence.
Comment #1 by dlang-bot — 2021-08-19T00:59:57Z
@ljmf00 updated dlang/phobos pull request #8197 "std.stdio: change exit(0) to _exit(0) to prevent segfault" fixing this issue: - std.stdio: change exit(0) to _exit(0) to prevent segfault Fixes #22222. `exit(0)` call from libc does an exit sequence before exit and therefore doesn't exit immediately. This causes problems on custom unittest runners. To circunvent this problem we should call `_exit()` syscall to exit immediately. In this context this is just fine to do and can prevent any future frustration when debugging. Signed-off-by: Luís Ferreira <[email protected]> https://github.com/dlang/phobos/pull/8197
Comment #2 by dlang-bot — 2021-08-19T04:23:52Z
dlang/phobos pull request #8197 "Fix issue #22222 - Custom unittest runner on phobos fails due to segfault on fork() exiting" was merged into master: - 757499319fe2314fe2d81dbc01330f0a5e23f9d3 by Luís Ferreira: std.stdio: change exit(0) to _exit(0) to prevent segfault Fixes #22222. `exit(0)` call from libc does an exit sequence before exit and therefore doesn't exit immediately. This causes problems on custom unittest runners. To circunvent this problem we should call `_exit()` syscall to exit immediately. In this context this is just fine to do and can prevent any future frustration when debugging. Signed-off-by: Luís Ferreira <[email protected]> https://github.com/dlang/phobos/pull/8197