Commit bfb7c2d5 authored by Nikodemus Siivola's avatar Nikodemus Siivola
Browse files

0.9.17.2: fix two potential GC deadlocks

 * Dying threads used to grab session and all-threads locks
   with GC inhibited, which was bad:
    1. T1 has the lock, GC not inhibited
       T2 in HANDLE-THREAD-EXIT waiting for the lock, GC inhibited
    2. GC is triggered
    3. T1 stopped while holding the lock
       T2 deadlocks waiting for T1 to release the lock.
 * Mark threads dead while holding the *ALL-THREADS-LOCK*, so that
     (unless (thread-alive-p th)
       (assert (not (member th (list-all-threads)))))
   cannot fail.
 * Since dying threads can now trigger GCs, don't run after-gc hooks
   and finalizers if the thread has been marked as dead.
 * Move all thread cleanup logic to HANDLE-THREAD exit.
parent c3554861
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment