tsan: fix failures after multi-threaded fork
Creating threads after a multi-threaded fork is semi-supported, we don't give particular guarantees, but we try to not fail on simple cases and we have die_after_fork=0 flag that enables not dying on creation of threads after a multi-threaded fork. This flag is used in the wild: https://github.com/mongodb/mongo/blob/23c052e3e321dbab90f1863d4d5539d7c1a1cf44/SConstruct#L3599 fork_multithreaded.cpp test started hanging in debug mode after the recent "tsan: fix deadlock during race reporting" commit, which added proactive ThreadRegistryLock check in SlotLock. But the test broke earlier after "tsan: remove quadratic behavior in pthread_join" commit which made tracking of alive threads based on pthread_t stricter (CHECK-fail on 2 threads with the same pthread_t, or joining a non-existent thread). When we start a thread after a multi-threaded fork, the new pthread_t can actually match one of existing values (for threads that don't exist anymore). Thread creation sta...
parent
d5b3cb07
Please register or sign in to comment