RESOLVED FIXED 122667
llint_slow_path_put_by_id can deadlock on a ConcurrentJITLock
https://bugs.webkit.org/show_bug.cgi?id=122667
Summary llint_slow_path_put_by_id can deadlock on a ConcurrentJITLock
Mark Hahnenberg
Reported 2013-10-11 11:45:45 PDT
llint_slow_path_put_by_id has the following line of code: 599 ConcurrentJITLocker locker(codeBlock->m_lock); and later in the same scope: 618 StructureChain* chain = structure->prototypeChain(exec); which can cause a garbage collection. Garbage collection acquires the ConcurrentJITLock as it processes CodeBlocks, causing a deadlock.
Attachments
Patch (25.97 KB, patch)
2013-10-11 15:35 PDT, Mark Hahnenberg
no flags
build fix (26.02 KB, patch)
2013-10-11 15:44 PDT, Mark Hahnenberg
no flags
omgjustbuild (26.33 KB, patch)
2013-10-11 16:36 PDT, Mark Hahnenberg
no flags
Patch (33.34 KB, patch)
2013-10-16 15:55 PDT, Mark Hahnenberg
ggaren: review+
Filip Pizlo
Comment 1 2013-10-11 11:49:53 PDT
(In reply to comment #0) > llint_slow_path_put_by_id has the following line of code: > > 599 ConcurrentJITLocker locker(codeBlock->m_lock); > > and later in the same scope: > > 618 StructureChain* chain = structure->prototypeChain(exec); > > which can cause a garbage collection. Garbage collection acquires the ConcurrentJITLock as it processes CodeBlocks, causing a deadlock. L
Filip Pizlo
Comment 2 2013-10-11 11:50:15 PDT
(In reply to comment #1) > (In reply to comment #0) > > llint_slow_path_put_by_id has the following line of code: > > > > 599 ConcurrentJITLocker locker(codeBlock->m_lock); > > > > and later in the same scope: > > > > 618 StructureChain* chain = structure->prototypeChain(exec); > > > > which can cause a garbage collection. Garbage collection acquires the ConcurrentJITLock as it processes CodeBlocks, causing a deadlock. > > L Dunno what happened there. I meant to say "Lol."
Filip Pizlo
Comment 3 2013-10-11 11:51:49 PDT
(In reply to comment #2) > (In reply to comment #1) > > (In reply to comment #0) > > > llint_slow_path_put_by_id has the following line of code: > > > > > > 599 ConcurrentJITLocker locker(codeBlock->m_lock); > > > > > > and later in the same scope: > > > > > > 618 StructureChain* chain = structure->prototypeChain(exec); > > > > > > which can cause a garbage collection. Garbage collection acquires the ConcurrentJITLock as it processes CodeBlocks, causing a deadlock. > > > > L > > Dunno what happened there. I meant to say "Lol." We could either move the call to prototypeChain(exec) up above the ConcurrentJITLocker, or we could do my favorite thing: DeferGC. I like DeferGC more since it's more comprehensive.
Mark Hahnenberg
Comment 4 2013-10-11 11:52:20 PDT
(In reply to comment #3) > (In reply to comment #2) > > (In reply to comment #1) > > > (In reply to comment #0) > > > > llint_slow_path_put_by_id has the following line of code: > > > > > > > > 599 ConcurrentJITLocker locker(codeBlock->m_lock); > > > > > > > > and later in the same scope: > > > > > > > > 618 StructureChain* chain = structure->prototypeChain(exec); > > > > > > > > which can cause a garbage collection. Garbage collection acquires the ConcurrentJITLock as it processes CodeBlocks, causing a deadlock. > > > > > > L > > > > Dunno what happened there. I meant to say "Lol." > > We could either move the call to prototypeChain(exec) up above the ConcurrentJITLocker, or we could do my favorite thing: DeferGC. > > I like DeferGC more since it's more comprehensive. Yeah I like that too.
Mark Hahnenberg
Comment 5 2013-10-11 11:53:29 PDT
(In reply to comment #4) > (In reply to comment #3) > > (In reply to comment #2) > > > (In reply to comment #1) > > > > (In reply to comment #0) > > > > > llint_slow_path_put_by_id has the following line of code: > > > > > > > > > > 599 ConcurrentJITLocker locker(codeBlock->m_lock); > > > > > > > > > > and later in the same scope: > > > > > > > > > > 618 StructureChain* chain = structure->prototypeChain(exec); > > > > > > > > > > which can cause a garbage collection. Garbage collection acquires the ConcurrentJITLock as it processes CodeBlocks, causing a deadlock. > > > > > > > > L > > > > > > Dunno what happened there. I meant to say "Lol." > > > > We could either move the call to prototypeChain(exec) up above the ConcurrentJITLocker, or we could do my favorite thing: DeferGC. > > > > I like DeferGC more since it's more comprehensive. > > Yeah I like that too. We could even make ConcurrentJITLocker do an implicit DeferGC. Thoughts?
Filip Pizlo
Comment 6 2013-10-11 11:55:29 PDT
(In reply to comment #5) > (In reply to comment #4) > > (In reply to comment #3) > > > (In reply to comment #2) > > > > (In reply to comment #1) > > > > > (In reply to comment #0) > > > > > > llint_slow_path_put_by_id has the following line of code: > > > > > > > > > > > > 599 ConcurrentJITLocker locker(codeBlock->m_lock); > > > > > > > > > > > > and later in the same scope: > > > > > > > > > > > > 618 StructureChain* chain = structure->prototypeChain(exec); > > > > > > > > > > > > which can cause a garbage collection. Garbage collection acquires the ConcurrentJITLock as it processes CodeBlocks, causing a deadlock. > > > > > > > > > > L > > > > > > > > Dunno what happened there. I meant to say "Lol." > > > > > > We could either move the call to prototypeChain(exec) up above the ConcurrentJITLocker, or we could do my favorite thing: DeferGC. > > > > > > I like DeferGC more since it's more comprehensive. > > > > Yeah I like that too. > > We could even make ConcurrentJITLocker do an implicit DeferGC. Thoughts? Or even better: have two versions of ConcurrentJITLocker. One version sets a thread-local variable that in causes all GC allocations and other GC calls to fail in debug mode. We could use that in as many places as possible. The cool thing about this is that it also guarantees that the method is safe to call from a concurrent thread, from the GC's standpoint. Another version does what you say. We can then try to use the asserting version in as many places as possible. Probably by doing this we will learn some fun surprises.
Mark Hahnenberg
Comment 7 2013-10-11 15:35:46 PDT
Filip Pizlo
Comment 8 2013-10-11 15:40:23 PDT
Comment on attachment 214030 [details] Patch love it.
EFL EWS Bot
Comment 9 2013-10-11 15:42:18 PDT
Mark Hahnenberg
Comment 10 2013-10-11 15:44:40 PDT
Created attachment 214031 [details] build fix
EFL EWS Bot
Comment 11 2013-10-11 15:49:20 PDT
EFL EWS Bot
Comment 12 2013-10-11 15:50:26 PDT
Comment on attachment 214031 [details] build fix Attachment 214031 [details] did not pass efl-wk2-ews (efl-wk2): Output: http://webkit-queues.appspot.com/results/3946253
Mark Hahnenberg
Comment 13 2013-10-11 16:36:17 PDT
Created attachment 214035 [details] omgjustbuild
WebKit Commit Bot
Comment 14 2013-10-14 11:58:26 PDT
Comment on attachment 214035 [details] omgjustbuild Rejecting attachment 214035 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-01', 'apply-attachment', '--no-update', '--non-interactive', 214035, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: avaScriptCore/llint/LLIntSlowPaths.cpp patching file Source/JavaScriptCore/runtime/ConcurrentJITLock.h patching file Source/JavaScriptCore/runtime/InitializeThreading.cpp patching file Source/JavaScriptCore/runtime/JSCellInlines.h patching file Source/JavaScriptCore/runtime/Structure.cpp patching file Source/JavaScriptCore/runtime/Structure.h Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force', '--reviewer', u'Filip Pizlo']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Full output: http://webkit-queues.appspot.com/results/3766906
Mark Hahnenberg
Comment 15 2013-10-14 12:33:12 PDT
WebKit Commit Bot
Comment 16 2013-10-14 14:56:22 PDT
Re-opened since this is blocked by bug 122779
Alexey Proskuryakov
Comment 17 2013-10-14 15:00:36 PDT
Mark Hahnenberg
Comment 19 2013-10-15 10:28:30 PDT
Ryosuke Niwa
Comment 20 2013-10-15 11:09:33 PDT
Mark Hahnenberg
Comment 21 2013-10-15 11:32:16 PDT
Mark Hahnenberg
Comment 22 2013-10-16 15:55:03 PDT
Geoffrey Garen
Comment 23 2013-10-16 16:10:48 PDT
Comment on attachment 214399 [details] Patch r=me based on previous reviews, assuming tests pass.
Mark Hahnenberg
Comment 24 2013-10-16 16:46:12 PDT
Note You need to log in before you can comment on or make changes to this bug.