Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avoid a deadlock in the idle watch reaper
Summary: here's an example of the deadlock: ``` Thread 53 (Thread 0x7f3f17fff700 (LWP 3247723)): #0 __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135 #1 0x00007f3f1dadbf2c in __GI___pthread_mutex_lock (mutex=mutex@entry=0x68f8e0 <root_lock>) at ../nptl/pthread_mutex_lock.c:80 #2 0x0000000000417b66 in remove_root_from_watched (root=0x692380) at root.c:1872 #3 w_root_stop_watch (root=root@entry=0x692380) at root.c:2251 #4 0x000000000041854b in consider_reap (root=0x692380) at root.c:1601 #5 notify_thread (root=0x692380) at root.c:1656 #6 run_notify_thread (arg=0x692380) at root.c:2148 #7 0x00007f3f1dad97f1 in start_thread (arg=0x7f3f17fff700) at pthread_create.c:310 #8 0x00007f3f1d81046d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109 Thread 52 (Thread 0x7f3f175fd700 (LWP 3247724)): #0 __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135 #1 0x00007f3f1dadbfb0 in __GI___pthread_mutex_lock (mutex=mutex@entry=0x692398) at ../nptl/pthread_mutex_lock.c:115 #2 0x0000000000415255 in w_root_lock (root=root@entry=0x692380) at root.c:313 #3 0x0000000000418bdc in w_root_save_state (state=state@entry=0x7f3f080480d0) at root.c:2444 #4 0x0000000000418ff8 in w_state_save () at state.c:98 #5 0x0000000000417bef in w_root_stop_watch (root=root@entry=0x693780) at root.c:2255 #6 0x000000000041854b in consider_reap (root=0x693780) at root.c:1601 #7 notify_thread (root=0x693780) at root.c:1656 #8 run_notify_thread (arg=0x693780) at root.c:2148 #9 0x00007f3f1dad97f1 in start_thread (arg=0x7f3f175fd700) at pthread_create.c:310 #10 0x00007f3f1d81046d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109 ``` Test Plan: augmented an integration test, but I couldn't get this to trigger on demand :-/ In the problem case, both watches were established from the state file and aged at at the exact same time. Reviewers: sid0 Differential Revision: https://reviews.facebook.net/D44841
- Loading branch information