Bug 194014

Summary: Fix deadlock on Linux/x64 between SamplingProfiler and VMTraps
Product: WebKit Reporter: Dominik Inführ <dominik.infuehr>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, commit-queue, dbates, ews-watchlist, guijemont, mcatanzaro, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Dominik Inführ
Reported 2019-01-30 03:09:51 PST
Fix deadlock on Linux/x64 between SamplingProfiler and VMTraps
Attachments
Patch (3.27 KB, patch)
2019-01-30 03:11 PST, Dominik Inführ
no flags
Patch (3.28 KB, patch)
2019-01-30 03:39 PST, Dominik Inführ
no flags
Patch (3.27 KB, patch)
2019-01-30 03:51 PST, Dominik Inführ
no flags
Patch (4.25 KB, patch)
2019-02-14 02:45 PST, Dominik Inführ
no flags
Dominik Inführ
Comment 1 2019-01-30 03:11:30 PST
Dominik Inführ
Comment 2 2019-01-30 03:39:01 PST
Dominik Inführ
Comment 3 2019-01-30 03:51:36 PST
Dominik Inführ
Comment 4 2019-01-30 08:12:21 PST
There was a deadlock in the following situation: Thread 1 (Sampling): In SamplingProfiler.cpp:takeSample it takes all locks and then tries to suspend the main thread. Thread 2 (Watchdog/VMTraps): Before the Sampling-Thread suspends the main thread a signal is caught and signal handler is invoked (VMTraps.cpp:SignalSender). SignalSender tries to lock codeBlockSet, but this is already locked by the SamplingProfiler. The SamplingProfiler can only give up the lock when it suspends the thread. However since the VMTraps signal handler is active, all other signals blocked, therefore the SamplingProfiler also waits until its signal handler is invoked. The patch fixes this by only blocking all signals except for SIGUSR1, which is used for suspending/resuming threads.
Michael Catanzaro
Comment 5 2019-01-30 11:19:53 PST
I would add that nice explanation of the deadlock to the ChangeLog, and also mention the flaky test this fixes.
Dominik Inführ
Comment 6 2019-02-14 02:45:58 PST
WebKit Commit Bot
Comment 7 2019-02-15 05:41:51 PST
Comment on attachment 362007 [details] Patch Clearing flags on attachment: 362007 Committed r241583: <https://trac.webkit.org/changeset/241583>
WebKit Commit Bot
Comment 8 2019-02-15 05:41:53 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9 2019-02-15 05:42:26 PST
Note You need to log in before you can comment on or make changes to this bug.