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

Đang mở
#43,926 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
linux, typescript
Lĩnh vực
backend, testing-qa

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
99.1k
Fork
6.8k
Merge trung bình
16 giờ 7 phút
Pull request đã merge (30 ngày)
325

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/playwright

Tất cả issue của microsoft/playwright

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.