• Andreas Haas's avatar
    [wasm] Run foreground compilation tasks as normal tasks · 1520a851
    Andreas Haas authored
    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: 's avatarMircea Trofin <mtrofin@chromium.org>
    Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#46343}
    1520a851
compilation-manager.h 1.48 KB