• Andreas Haas's avatar
    [d8] Avoid lock-order-inversion warning in the DefaultPlatform · 40a5328b
    Andreas Haas authored
    This CL fixes two lock-order-inversion warning in the DefaultPlatform.
    The problem was that during shutdown locks get taken in the oposite
    order than during initialization.
    
    The first two conflicting locks were the WasmEngine lock and the
    lock of the DefaultTaskRunner. During WasmEngine initialization, when
    the WasmEngine lock is hold, a foreground task is scheduled, which
    requires the TaskRunner lock. During shutdown, the task queue of the
    TaskRunner gets drained while holding the TaskRunner lock. Thereby
    the destructors of the tasks get executed, and the LogCode task of
    the WasmEngine thereby acquires the WasmEngine lock.
    
    The second conflict happens between the WasmEngine lock and the
    DefaultPlatform lock, where the DefaultPlatform lock is taken during
    WasmEngine initialization when the ForegroundTaskrunner is acquired.
    During Shutdown, the DefaultPlatform lock was hold while the task
    queue was drained, as described above.
    
    Bug: chromium:1346250
    Change-Id: Ib67d0c6cad1372e7c592f40bbe68b0ae31b2976b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3782796
    Commit-Queue: Andreas Haas <ahaas@chromium.org>
    Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#81911}
    40a5328b
default-platform.cc 10.1 KB