Mid-frame view flushing can deadlock when the render thread synchronously waits for JavaScript

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

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

@bkaradzic-microsoft đang làm issue này rồi.

Từ ngày 30/9/2026.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp, javascript
Lĩnh vực
computer-graphics

Hướng nghiên cứu

Start in Core/Graphics/Source/DeviceImpl.cpp at upstream commit 3450373508, tracing FlushViewsIfNeeded(), PerformMidFrameViewFlush(), and FinishRenderingCurrentFrame(). Exercise the triggering sequence around the maxViews - 16 threshold and confirm the circular wait or establish the required host-side frame-pumping contract. Done means the flush no longer hangs, or unsupported synchronous dispatch fails explicitly and its contract is documented and enforced.

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

Mô tả

Summary

DeviceImpl::FlushViewsIfNeeded() can wait indefinitely when an embedding application synchronously waits for JavaScript rendering to finish before calling FinishRenderingCurrentFrame().

The current guard checks that at least one frame-completion scope is active, but an active scope does not establish that the render thread is available to service a mid-frame flush.

Triggering sequence
  1. The render thread dispatches rendering work to the JS thread and synchronously waits for it to complete, intending to finish the native frame afterward.
  2. With a frame-completion scope active, JS submits enough render-target passes to reach the mid-frame view-flush threshold (maxViews - 16).
  3. FlushViewsIfNeeded() sets m_flushRequested and waits on m_flushCompleteCV.
  4. The render thread cannot reach FinishRenderingCurrentFrame() to service that request until JS returns. JS cannot return until the flush completes.

This creates a circular wait:

Render thread: waiting for JS rendering to complete
JS thread:     waiting for render thread to service a view flush
Expected behavior

The flush should complete, or an unsupported frame-driving pattern should fail explicitly rather than hang. If synchronous dispatch is unsupported, the required host-side frame-pumping contract should be documented and enforced.

Evidence and scope

A repeatable rendering stall was observed when the workload crossed the flush threshold. The circular-wait explanation is based on source inspection; a debugger-confirmed pair of blocked thread stacks and a standalone public reproducer are not yet available.

The relevant implementation is DeviceImpl.cpp at upstream commit 3450373508, particularly FlushViewsIfNeeded(), PerformMidFrameViewFlush(), and FinishRenderingCurrentFrame().

Increasing the view capacity avoids this path for workloads that remain below the new threshold, but does not fix the underlying synchronization dependency.

Ngôn ngữ chính
C++
Star
931
Fork
169
Merge trung bình
2 ngày 17 giờ
Pull request đã merge (30 ngày)
66

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 BabylonJS/BabylonNative

Tất cả issue của BabylonJS/BabylonNative

Issue tương tự

Thêm issue về C++

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.