optimize for diagnosis of deadlock it is not intuitive we use pstack/thread backtrace all to get lock information, or the original debug information.
util: optimize for diagnosis of deadlock #16276
pull orientye wants to merge 1 commits into bitcoin:master from orientye:master changing 2 files +8 −0-
orientye commented at 11:05 AM on June 24, 2019: contributor
-
optimize for diagnosis of deadlock 70829236ff
- fanquake added the label Utils/log/libs on Jun 24, 2019
-
MarcoFalke commented at 1:05 PM on June 24, 2019: member
Can you post an example debug log section of the changes?
-
orientye commented at 1:41 AM on June 25, 2019: contributor
thank you for your question. let me try to be clear.
(1)while thread lock and unlock cs_main, the log show like this, LOCKCONTENTION: cs_main Locker: src\validation.cpp:2383
but we do not know which state it is, unlocked, or keep waiting for the lock.
(2)after insert of PrintLockContentionOwned(), now we know it is unlocked or keep waiting.
now the log show like this if it is unlocked: LOCKCONTENTION: cs_main Locker: src\validation.cpp:2383 LOCKOWNED after lock contention: cs_main Locker: src\validation.cpp:2383
Another case is that, it is keep waiting: LOCKCONTENTION: cs_main Locker: src\validation.cpp:2383
(3)in our case, there are many threads has locked cs_main, thread1, thread2, thread3, thread4, etc... and there is a deadlock which potential_deadlock_detected() can not decect because another lock is not CCriticalSection, but we could not known which thread keeps waiting for cs_main.
as LOCKOWNED log, now we know thread1, thread4, has owned and unlock cs_main, but thread2 and thread3 keep waiting for cs_main and may be in deadlock state.
-
laanwj commented at 7:32 AM on July 31, 2019: member
Please, change the PR and commit title to something that summarizes the change. "optimize for diagnosis of deadlock" is too general, and this doesn't involve any optimization.
Also: need someone familiar with hunting down deadlock issues (maybe @TheBlueMatt) to comment on this change.
- MarcoFalke renamed this:
optimize for diagnosis of deadlock
util: optimize for diagnosis of deadlock
on Jul 31, 2019 -
laanwj commented at 12:13 PM on September 30, 2019: member
The benefit of this change does not seem to be sufficiently clear to reviewers. Closing this for now.
- laanwj closed this on Sep 30, 2019
- DrahtBot locked this on Dec 16, 2021