[BUG] WebKit (Linux, WPE): WebProcess main thread deadlocks when a muted video is suspended for being out of the viewport during preroll

オープン
#43,926 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
linux, typescript

調査の方向性

Start by running the standalone repro.html and run.mjs reproducer in the Playwright Linux WebKit build and compare the trigger with toggle=0 and muted=0. Read the supplied GStreamer logs and thread dumps to trace the viewport suspension state change against the synchronous bus handler. Done when the reproducer completes reliably without the WebProcess main thread blocking.

索引モデルが issue の本文から書いたものです。

説明

needs-triage
Version
  • Playwright 1.64.1, browser webkit-2370 (WebKit 27.2), WPE MiniBrowser, headless.
  • Ubuntu 24.04 (mcr.microsoft.com/playwright:v1.64.1-noble); also seen on GitHub Actions ubuntu-24.04.
  • GStreamer 1.24.2 (plugins-base 1.24.2, plugins-good 1.24.2, libav 1.24.1).
Steps to reproduce

Use the standalone reproducer, which contains no project code: repro.html and run.mjs.

docker run --rm -it mcr.microsoft.com/playwright:v1.64.1-noble bash
# inside: copy repro.html, run.mjs and any H.264/AAC MP4 (e.g. tiny-10s.mp4 below) into a folder
npm init -y && npm i [email protected]
node run.mjs tiny-10s.mp4 "" 5          # trigger
node run.mjs tiny-10s.mp4 toggle=0 5    # control

Sample media (synthetic, BSD-3-Clause): tiny-10s.mp4.

repro.html creates a muted <video> with a blob: URL and moves it in and out of the viewport on every animation frame until loadedmetadata, for 20 iterations. run.mjs serves the page and the media with page.route, then reports STALL if page.evaluate/textContent gets no answer for 3 s.

Expected: all iterations complete; the control finishes in about 1.7 s.

Actual: within a few iterations the WebProcess main thread blocks permanently. The page answers no Playwright call, and every test using the page times out. Measured:

Variant Result
Trigger stalled 5/5, 5/5, 3/3 (three batches); 2/2 in an independent re-run
toggle=0 (video not moved) passed 5/5, 3/3, 2/2
muted=0 passed 5/5
Diagnosis (gdb on the hung WPEWebProcess, ~0 % CPU)
Thread 1 "WPEWebProcess"               <- main thread
#0  futex_wait / ___pthread_mutex_lock
#5  gst_pad_set_active ()              <- needs the pad's stream lock
#13 gst_element_change_state ()        (playbin3 -> uridecodebin3 -> decodebin3)
#23 ?? libWPEWebKit-2.0.so.1           <- MediaPlayerPrivateGStreamer state change

Thread 7 "qtdemux1:sink"               <- streaming thread, holds the stream lock
#4  ___pthread_cond_wait ()
#5  ?? libWPEWebKit-2.0.so.1           <- waits for the main thread
#14 gst_bus_sync_signal_handler ()
#15 gst_bus_post ()

The GStreamer log shows managePlayerSuspend: Muted video player not visible in viewport. The main thread then sets playbin3 to READY and blocks in gst_pad_set_active, waiting for the stream lock. Meanwhile qtdemux:sink holds that lock and waits in the synchronous bus handler for the main thread.

Full dumps:

Write-up: docs/investigations/webkit-17.md.

The WebKit library in the browser build has no debug symbols, so WebKit frames are unresolved.

Expected behaviour

Suspending a player must not block the main thread on a GStreamer streaming thread that is itself waiting for the main thread. Possible fixes: defer the state change, perform it asynchronously, or make the sync bus handler non-blocking for this path.

Real-world trigger

In our application the stall occurs with a sandboxed iframe containing a muted <video> (no controls) on a blob: URL plus a <track default>. Removing muted, the <track>, its default, or the media avoids it.

Not tested

WebKitGTK (headed), Safari on macOS, newer GStreamer.

主要言語
TypeScript
スター
99.1k
フォーク
6.8k
平均マージ
17時間 6分
マージ済み PR(30日)
306

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/playwright のほかの issue

microsoft/playwright の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。