Am 26.02.2025 um 09:50 hat Thomas Huth geschrieben: > When compiling QEMU with --enable-trace-backends=simple , the > iotest 233 is currently hanging. This happens because qemu-nbd > calls trace_init_backends() first - which causes simpletrace to > install its writer thread and the atexit() handler - before > calling fork(). But the simpletrace writer thread is then only > available in the parent process, not in the child process anymore. > Thus when the child process exits, its atexit handler waits forever > on the trace_empty_cond condition to be set by the non-existing > writer thread, so the process never finishes. > > Fix it by installing a pthread_atfork() handler, too, which > makes sure that the trace_writeout_enabled variable gets set > to false again in the child process, so we can use it in the > atexit() handler to check whether we still need to wait on the > writer thread or not. > > Signed-off-by: Thomas Huth <th...@redhat.com>
I can see how this would fix the hang, but do we actually get the trace events written out somewhere then? Or do we need to make sure that the child process has a writer thread, too? Of course, the question would then be how the two processes writing into the same trace file interact. Kevin