Closed Bug 1765214 Opened 3 years ago Closed 3 years ago

DCSurfaceVideo calls CloseHandle on the swap chain which throws 0xC0000008: invalid handle.

Categories

(Core :: Graphics, defect)

Firefox 101
Desktop
Windows 10
defect

Tracking

()

RESOLVED FIXED
101 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox99 --- wontfix
firefox100 --- fixed
firefox101 --- fixed

People

(Reporter: Zaggy1024, Assigned: sotaro)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(2 files)

Attached file about_support.json (deleted) —

When viewing an H264 video while debugging in Windows, then reloading the page, an exception is thrown in ReleaseDecodeSwapChainResources. The exception details are here:

Exception thrown at 0x00007FFF13150C7A (ntdll.dll) in firefox.exe: 0xC0000008: An invalid handle was specified.

In some instances, I observed that the DCSurfaceVideo was being freed before ReleaseDecodeSwapChainResources was called, but sometimes the handle is also still set to a valid value such as 0x000000e8b712d150.

Raw data from about:support in the debug environment is attached.

Stack trace:

ntdll.dll!KiRaiseUserExceptionDispatcher()
KernelBase.dll!CloseHandle()
[Inline Frame] xul.dll!mozilla::wr::DCSurfaceVideo::ReleaseDecodeSwapChainResources() Line 1172
xul.dll!mozilla::wr::DCSurfaceVideo::CalculateSwapChainSize(mozilla::gfx::BaseMatrix<float> & aTransform) Line 871
xul.dll!mozilla::wr::DCLayerTree::AddSurface(mozilla::wr::NativeSurfaceId aId, const mozilla::wr::Transform3D<float,mozilla::wr::DevicePixel,mozilla::wr::DevicePixel> & aTransform, mozilla::wr::Box2D<int,mozilla::wr::DevicePixel> aClipRect, mozilla::wr::ImageRendering aImageRendering) Line 556
xul.dll!mozilla::wr::RenderCompositorANGLE::AddSurface(mozilla::wr::NativeSurfaceId aId, const mozilla::wr::Transform3D<float,mozilla::wr::DevicePixel,mozilla::wr::DevicePixel> & aTransform, mozilla::wr::Box2D<int,mozilla::wr::DevicePixel> aClipRect, mozilla::wr::ImageRendering aImageRendering) Line 895
xul.dll!wr_compositor_add_surface(void * aCompositor, mozilla::wr::NativeSurfaceId aId, const mozilla::wr::Transform3D<float,mozilla::wr::DevicePixel,mozilla::wr::DevicePixel> * aTransform, mozilla::wr::Box2D<int,mozilla::wr::DevicePixel> aClipRect, mozilla::wr::ImageRendering aImageRendering) Line 45
xul.dll!webrender_bindings::bindings::impl$21::add_surface(webrender_bindings::bindings::WrCompositor * self, webrender::composite::NativeSurfaceId id, euclid::transform3d::Transform3D<f32,webrender_api::units::DevicePixel,webrender_api::units::DevicePixel> transform, euclid::box2d::Box2D<i32,webrender_api::units::DevicePixel> clip_rect, webrender_api::display_item::ImageRendering image_rendering) Line 1361
xul.dll!webrender::composite::CompositeState::composite_native(webrender_api::color::ColorF self, slice$<euclid::box2d::Box2D<i32,webrender_api::units::DevicePixel>> clear_color, ref_mut$<dyn$<webrender::composite::Compositor>>) Line 6341
xul.dll!webrender::renderer::Renderer::draw_frame(webrender::frame_builder::Frame * self, enum$<core::option::Option<euclid::size::Size2D<i32,webrender_api::units::DevicePixel>>> frame, unsigned __int64 device_size, webrender::renderer::RenderResults * buffer_age) Line 4740
xul.dll!webrender::renderer::Renderer::render_impl(webrender_api::DocumentId self, webrender::internal_types::RenderedDocument * doc_id, enum$<core::option::Option<euclid::size::Size2D<i32,webrender_api::units::DevicePixel>>> active_doc, unsigned __int64 device_size) Line 2024
xul.dll!webrender::renderer::Renderer::render(euclid::size::Size2D<i32,webrender_api::units::DevicePixel> self, unsigned __int64 buffer_age) Line 1744
xul.dll!webrender_bindings::bindings::wr_renderer_render(webrender::renderer::Renderer * renderer, int width, int height, unsigned __int64 buffer_age, webrender::renderer::RendererStats * out_stats, thin_vec::ThinVec<euclid::box2d::Box2D<i32,webrender_api::units::DevicePixel>> * out_dirty_rects) Line 620
xul.dll!mozilla::wr::RendererOGL::UpdateAndRender(const mozilla::Maybe<mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits>> & aReadbackSize, const mozilla::Maybe<mozilla::wr::ImageFormat> & aReadbackFormat, const mozilla::Maybe<mozilla::Range<unsigned char>> & aReadbackBuffer, bool * aNeedsYFlip, mozilla::wr::RendererStats * aOutStats) Line 185
xul.dll!mozilla::wr::RenderThread::UpdateAndRender(mozilla::wr::WrWindowId aWindowId, const mozilla::layers::BaseTransactionId<mozilla::VsyncIdType> & aStartId, const mozilla::TimeStamp & aStartTime, bool aRender, const mozilla::Maybe<mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits>> & aReadbackSize, const mozilla::Maybe<mozilla::wr::ImageFormat> & aReadbackFormat, const mozilla::Maybe<mozilla::Range<unsigned char>> & aReadbackBuffer, bool * aNeedsYFlip) Line 537
xul.dll!mozilla::wr::RenderThread::HandleFrameOneDoc(mozilla::wr::WrWindowId aWindowId, bool aRender) Line 393
[Inline Frame] xul.dll!mozilla::detail::RunnableMethodArguments<mozilla::wr::WrWindowId,bool>::applyImpl(mozilla::wr::RenderThread * o, void(mozilla::wr::RenderThread::*)(mozilla::wr::WrWindowId, bool) m, mozilla::Tuple<StoreCopyPassByConstLRef<mozilla::wr::WrWindowId>,StoreCopyPassByConstLRef<bool>> & args, std::integer_sequence<unsigned long long,0,1>) Line 1147
[Inline Frame] xul.dll!mozilla::detail::RunnableMethodArguments<mozilla::wr::WrWindowId,bool>::apply(mozilla::wr::RenderThread * o, void(mozilla::wr::RenderThread::*)(mozilla::wr::WrWindowId, bool) m) Line 1153
xul.dll!mozilla::detail::RunnableMethodImpl<mozilla::wr::RenderThread *,void (mozilla::wr::RenderThread::*)(mozilla::wr::WrWindowId, bool),1,mozilla::RunnableKind::Standard,mozilla::wr::WrWindowId,bool>::Run() Line 1203
xul.dll!nsThread::ProcessNextEvent(bool aMayWait, bool * aResult) Line 1174
xul.dll!NS_ProcessNextEvent(nsIThread * aThread, bool aMayWait) Line 465
xul.dll!mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate * aDelegate) Line 330
xul.dll!MessageLoop::RunHandler() Line 374
xul.dll!MessageLoop::Run() Line 356
xul.dll!nsThread::ThreadFunc(void * aArg) Line 380
nss3.dll!_PR_NativeRunThread(void * arg) Line 408
nss3.dll!pr_root(void * arg) Line 140
[External Code]
[Inline Frame] mozglue.dll!mozilla::interceptor::FuncHook<mozilla::interceptor::WindowsDllInterceptor<mozilla::interceptor::VMSharingPolicyShared>,void (*)(int, void *, void *)>::operator()(int & aArgs, void * & aArgs, void * & aArgs) Line 150
mozglue.dll!patched_BaseThreadInitThunk(int aIsInitialThread, void * aStartAddress, void * aThreadParam) Line 568
[External Code]

ni :sotaro as I've been told you might know something about this.

Flags: needinfo?(sotaro.ikeda.g)

Thanks for reporting. I take a bug.

Flags: needinfo?(sotaro.ikeda.g)
Assignee: nobody → sotaro.ikeda.g

Oh, the problem happened by my mistake :(

Regressed by: 1460499
Blocks: video-perf
Pushed by sikeda.birchill@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1bbd479005bd Fix DCSurfaceVideo::mSwapChainSurfaceHandle initialization r=gfx-reviewers,jrmuizel

Comment on attachment 9272780 [details]
Bug 1765214 - Fix DCSurfaceVideo::mSwapChainSurfaceHandle initialization

Beta/Release Uplift Approval Request

  • User impact if declined: An exception is thrown when video is loaded. It is caught when debugger is attached. YUV overlay is enabled on beta now by Bug 1760724.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: none
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): The change just initialize DCSurfaceVideo::mSwapChainSurfaceHandle to 0.
  • String changes made/needed: none
Attachment #9272780 - Flags: approval-mozilla-beta?

Set release status flags based on info from the regressing bug 1460499

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 101 Branch
Has Regression Range: --- → yes

Comment on attachment 9272780 [details]
Bug 1765214 - Fix DCSurfaceVideo::mSwapChainSurfaceHandle initialization

Approved for 100.0b8

Attachment #9272780 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: