New issue
Advanced search Search tips

Issue 706186 link

Starred by 1 user

Issue metadata

Status: Archived
Owner:
Closed: Apr 2017
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Deadlock during shutdown after using accelerated Jpeg decode

Project Member Reported by chfremer@chromium.org, Mar 28 2017

Issue description

Chrome Version: Found in tip of tree. Problem potentially existed for a while already.

What steps will reproduce the problem?
Not clear if this ever happened in a released build. In theory, it might happen using the following steps.
(1) On a Chromium OS device, start video capture from a webcam that delivers MJPEG.
(2) Shut down Chrome

What is the expected result?
Clean shutdown.

What happens instead?
Might cause a hang.


 
Code review for a fix is up: https://codereview.chromium.org/2786503002#
Status: Assigned (was: Untriaged)
Project Member

Comment 3 by bugdroid1@chromium.org, Mar 29 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c64c69fce0b29af200419ab2f9df75e3d8e693d5

commit c64c69fce0b29af200419ab2f9df75e3d8e693d5
Author: chfremer <chfremer@chromium.org>
Date: Wed Mar 29 20:51:08 2017

A deadlock could happen in the following situation:
1. As part of program shutdown, VideoCaptureManager::StopCaptureForClient() is
   called. This posts a task to destroy the capture device to the "device
   thread", which eventually leads to this destructor being called (on the
   "device thread").
2. While things on the "device thread" are running asynchronously,
   BrowserMainLoop is being destroyed. It's destructor waits for the "device
   thread" (audio thread) to complete.
3. |io_task_runner_| does not accept the posted task anymore.
4. |event.Wait()| will wait indefinitely causing the shutdown to hang.

This deadlock occurred on build bot linux_android_rel_ng in CL
https://codereview.chromium.org/2772963002/. It reproduces locally on a Nexus 5
device running KitKat.

In production, class GpuJpegDecodeAcceleratorHost is currenlty only used on
Chrome OS, but it might happen there as well, since the situation does not
appear to be platform-dependent.

BUG= 706186 
TEST=
  content_browsertests --gtest_filter="VideoCaptureBrowserTest.*"
  content_unittests --gtest_filter="*Video*"
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2786503002
Cr-Commit-Position: refs/heads/master@{#460531}

[modify] https://crrev.com/c64c69fce0b29af200419ab2f9df75e3d8e693d5/media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.cc

Project Member

Comment 4 by bugdroid1@chromium.org, Mar 31 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b5d9d73d3108767c038c2b9a8d6aff786edbaa1e

commit b5d9d73d3108767c038c2b9a8d6aff786edbaa1e
Author: chfremer <chfremer@chromium.org>
Date: Fri Mar 31 06:03:26 2017

Fix DCHECK getting hit on destruction of GpuJpegDecodeAcceleratorHost

The previous fix for a deadlock (https://codereview.chromium.org/2786503002/)
was only partly effective. Even though it prevented the deadlock waiting for
a method that was never run, it now hits a DCHECK when the WeakPtrs are
invalidated on the wrong thread (synchronously as part of the destructor call).

To prevent this, we add a |io_task_runner_->DeleteSoon(weak_factory_for_io_)| to
the destructor of GpuJpegDecodeAcceleratorHost::Receiver. When |io_task_runner_|
no longer accepts tasks, this effectively leaks |weak_factory_for_io_|, and
therefore avoids hitting the DCHECK.

BUG= 706186 
TEST=
  content_browsertests --gtest_filter="VideoCaptureBrowserTest.*"
  content_unittests --gtest_filter="*Video*"
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2783273002
Cr-Commit-Position: refs/heads/master@{#461053}

[modify] https://crrev.com/b5d9d73d3108767c038c2b9a8d6aff786edbaa1e/media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.cc

Status: Fixed (was: Assigned)

Comment 6 by dchan@google.com, May 30 2017

Labels: VerifyIn-60

Comment 7 by dchan@chromium.org, Aug 1 2017

Labels: VerifyIn-61

Comment 8 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)

Sign in to add a comment