Bug 15268 – possible deadlock for Thread.getAll/Thread.opApply w/ GC.collect

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-10-30T20:26:00Z
Last change time
2016-01-03T14:10:08Z
Keywords
pull
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2015-10-30T20:26:20Z
This is a classical lock inversion deadlock. GC.collect -> gclock -> thread_suspendAll -> slock Thread.getAll -> slock -> GC.malloc -> gclock Anyone holding slock must not use the GC.
Comment #1 by code — 2015-10-31T03:35:25Z
Comment #2 by github-bugzilla — 2015-10-31T09:44:57Z
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/d56a25997c069d6f5e657288f5d2d857dbd1a4fc fix Issue 15268 - deadlock for Thread.getAll/Thread.opApply - fix a deadlock caused by lock order inversion - must not use the GC while holding slock https://github.com/D-Programming-Language/druntime/commit/713aa0568a0ba7d775e97c59a7590048c5e6d762 Merge pull request #1421 from MartinNowak/fix15268 fix Issue 15268 - deadlock for Thread.getAll/Thread.opApply
Comment #3 by github-bugzilla — 2016-01-03T14:10:08Z