https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199557
--- Comment #5 from ikosa...@accesssoftek.com --- (In reply to Ed Maste from comment #2) > Pointed out by kib, when invoking the fork syscall directly the child > inherits potentially locked libc mutexes, and it's probably the printf > that hangs, not the sysconf. Note that the code doesn't leverage libc's printf(), but rather uses its own version of it. > What was the original underlying issue here? The original problem is random Tsan tests hanging on high loaded machines like the FreeBSD sanitizers buildbot: http://lab.llvm.org:8011/builders/sanitizer_x86_64-freebsd/builds/4978/steps/make-check-tsan/logs/stdio It mostly work fine when the tests run in about 4 threads, but tends to fail constantly when run in about 64 threads--doesn't matter how much cores the hardware has. This is how it leads to the point of hang: during execution of a Tsan tests the Tsan STL catches a data race or other condition triggering a run-time report. That report contains references to related object files and associated addresses. These file names together with the addresses are then translated into source file name, line numbers and function names by calling the llvm-symbolizer or, if the RTL is unable to locate it, the addr2line command. To catch the output of the symbolizing tool the RTL fork() the process and redirects the streams. This is where the whole thing hangs. Note is that if I comment the sysconf(_SC_OPEN_MAX) call, then it hangs on one of the other subsequent system calls, like read() so it appears to not to be a sysconf()-specific issue. Another note is that the RTL sources refer to a specific reason about why it tries to use the syscall fork() in place of the libc's intercepted one: // Real fork() may call user callbacks registered with pthread_atfork(). pid = internal_fork(); The internal_fork() function is just the syscall: int internal_fork() { #if SANITIZER_USES_CANONICAL_LINUX_SYSCALLS return internal_syscall(SYSCALL(clone), SIGCHLD, 0); #else return internal_syscall(SYSCALL(fork)); #endif } -- You are receiving this mail because: You are the assignee for the bug. _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"