• Andreas Haas's avatar
    Revert "[wasm] Run foreground compilation tasks as normal tasks" · 89154bf6
    Andreas Haas authored
    This reverts commit 1520a851.
    
    Reason for revert: This CL does not do what it should. All tasks which access the isolate have to be cancelable to guarantee that the isolate still exists when the task is executed. Foreground compilation tasks access the isolate, so they cannot be just normal tasks.
    
    Original change's description:
    > [wasm] Run foreground compilation tasks as normal tasks
    > 
    > This CL makes foreground compilation tasks normal (i.e. not cancelable)
    > again, because otherwise a deadlock can happen. I think the reason why
    > the foreground tasks were cancelable was to make sure that all tasks
    > either finish correctly or get canceled. However, since the isolate can
    > only shut down on the main thread, this means that the foreground task
    > should have already finished when the isolate shuts down, or it should
    > not have started at all. I reordered the deletion of the AsyncCompileJob
    > though to make sure that an AsyncCompileJob is removed from
    > CompilationManager before its promise is resolved.
    > 
    > Here is the deadlock: The JS code which is executed after a promise is
    > resolved is executed within the task which resolves the promise. In case
    > of async compilation this means that some JS code is executed within a
    > CompileTask. In JS, the shutdown of the isolate can be triggered. During
    > the shutdown of the isolate, the CancelableTaskManager waits for all
    > registered cancelable tasks to complete, including the CompileTask of
    > async compilation. This means that the CancelableTaskManager waits for
    > itself to finish, which is a deadlock.
    > 
    > R=​clemensh@chromium.org, mtrofin@chromium.org
    > 
    > Change-Id: I9f8c7fb2cfc5b9bfc53c761010b1590293bb82c9
    > Reviewed-on: https://chromium-review.googlesource.com/554733
    > Commit-Queue: Andreas Haas <ahaas@chromium.org>
    > Reviewed-by: Mircea Trofin <mtrofin@chromium.org>
    > Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#46343}
    
    TBR=mtrofin@chromium.org,ahaas@chromium.org,clemensh@chromium.org
    
    Change-Id: I60fab90b46d70c703d827816503e7e23b8c50251
    No-Presubmit: true
    No-Tree-Checks: true
    No-Try: true
    Reviewed-on: https://chromium-review.googlesource.com/558284Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
    Commit-Queue: Andreas Haas <ahaas@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#46353}
    89154bf6
compilation-manager.cc 925 Bytes