|
|
DescriptionFix errors in destruction sequence of GpuVideoEncodeAccelerator::OnWillDestroyStub()
On Windows, we can use GPU IO thread to filter some messages for GPUVEA.
In that case, while GpuVideoEncodeAccelerator::OnWillDestroyStub() is running
on main thread, GpuVideoEncodeAccelerator::OnEncodeFrameCreated() can run
on IO thread. If |encoder_| is reset on main thread and accessed on IO
thread, we see the crashes listed on the bug.
This CL solves the issue by:
- Checking |filter_removed_| which is signaled on IO thread before deciding
to continue with encode GpuVideoEncodeAccelerator::OnEncodeFrameCreated() on
IO thread.
- Making sure that |encoder_worker_thread_| tasks are completed before reset.
BUG=715759
TEST=Tested AppRTC loopback with H264.
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/2849443003
Cr-Commit-Position: refs/heads/master@{#468457}
Committed: https://chromium.googlesource.com/chromium/src/+/a561de6d59f43481c46e61a34508fa15c5fd2abd
Patch Set 1 #
Total comments: 4
Patch Set 2 : #
Total comments: 2
Patch Set 3 : #Patch Set 4 : #
Messages
Total messages: 33 (26 generated)
Description was changed from ========== fix threading BUG= ========== to ========== fix threading BUG= 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 ==========
The CQ bit was checked by emircan@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) linux_chromium_tsan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...) mac_chromium_compile_dbg_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_comp...) mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_...)
The CQ bit was checked by emircan@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
Patchset #1 (id:1) has been deleted
Patchset #1 (id:20001) has been deleted
Description was changed from ========== fix threading BUG= 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 ========== to ========== Fix errors in destruction sequence of GpuVideoEncodeAccelerator::OnWillDestroyStub() On Windows, we can use GPU IO thread to filter some messages for GPUVEA. In that case, while GpuVideoEncodeAccelerator::OnWillDestroyStub() is running on main thread, GpuVideoEncodeAccelerator::OnEncodeFrameCreated() can run on IO thread. If |encoder_| is reset on main thread and accessed on IO thread, we see the crashes listed on the bug. This CL solves the issue by: - Checking |filter_removed_| which is signaled on IO thread before deciding to continue with encode GpuVideoEncodeAccelerator::OnEncodeFrameCreated() on IO thread. - Making sure that |encoder_worker_thread_| tasks are completed before reset. BUG=715759 TEST=Tested AppRTC loopback with H264. 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 ==========
emircan@chromium.org changed reviewers: + posciak@chromium.org, sandersd@chromium.org
PTAL.
https://codereview.chromium.org/2849443003/diff/40001/media/gpu/ipc/service/g... File media/gpu/ipc/service/gpu_video_encode_accelerator.cc (right): https://codereview.chromium.org/2849443003/diff/40001/media/gpu/ipc/service/g... media/gpu/ipc/service/gpu_video_encode_accelerator.cc:328: weak_this_factory_for_encoder_worker_.GetWeakPtr())); This WeakPtrFactory should probably not be vending outside of the worker thread. It seems that it should be possible to create a weak pointer at worker thread creation time and then just use copies of that? I'm not entirely sure what's going on with |weak_this_factory_|. It is used for posting to the main task runner but then is invalidated on the IO task runner?
https://codereview.chromium.org/2849443003/diff/40001/media/gpu/ipc/service/g... File media/gpu/ipc/service/gpu_video_encode_accelerator.cc (right): https://codereview.chromium.org/2849443003/diff/40001/media/gpu/ipc/service/g... media/gpu/ipc/service/gpu_video_encode_accelerator.cc:328: weak_this_factory_for_encoder_worker_.GetWeakPtr())); On 2017/04/28 00:47:44, sandersd wrote: > This WeakPtrFactory should probably not be vending outside of the worker thread. > It seems that it should be possible to create a weak pointer at worker thread > creation time and then just use copies of that? Sure. I changed it such that we use copies of the same WeakPtr. > > I'm not entirely sure what's going on with |weak_this_factory_|. It is used for > posting to the main task runner but then is invalidated on the IO task runner? There is actually 2 WeakPtrFactories here: - |weak_this_factory_for_encoder_worker_| to post on |encoder_worker_thread_|. It is also invalidated there. - |weak_this_factory_| to post either main or io thread, based on |filter_|. The choice is then stored as |encode_task_runner_| where this is posted. It is invalidated on io if there is |filter_|, or on main(dtor) otherwise.
Patchset #2 (id:60001) has been deleted
lgtm https://codereview.chromium.org/2849443003/diff/40001/media/gpu/ipc/service/g... File media/gpu/ipc/service/gpu_video_encode_accelerator.cc (right): https://codereview.chromium.org/2849443003/diff/40001/media/gpu/ipc/service/g... media/gpu/ipc/service/gpu_video_encode_accelerator.cc:328: weak_this_factory_for_encoder_worker_.GetWeakPtr())); > - |weak_this_factory_| to post either main or io thread, based on |filter_|. The > choice is then stored as |encode_task_runner_| where this is posted. It is > invalidated on io if there is |filter_|, or on main(dtor) otherwise. Please document this in the header file, the current comment about VideoFrames is not as clear. https://codereview.chromium.org/2849443003/diff/80001/media/gpu/ipc/service/g... File media/gpu/ipc/service/gpu_video_encode_accelerator.cc (right): https://codereview.chromium.org/2849443003/diff/80001/media/gpu/ipc/service/g... media/gpu/ipc/service/gpu_video_encode_accelerator.cc:174: weak weak_this_factory_for_encoder_worker_(this), Presumably does not compile.
The CQ bit was checked by emircan@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by emircan@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2849443003/diff/40001/media/gpu/ipc/service/g... File media/gpu/ipc/service/gpu_video_encode_accelerator.cc (right): https://codereview.chromium.org/2849443003/diff/40001/media/gpu/ipc/service/g... media/gpu/ipc/service/gpu_video_encode_accelerator.cc:328: weak_this_factory_for_encoder_worker_.GetWeakPtr())); On 2017/04/28 18:22:44, sandersd wrote: > > - |weak_this_factory_| to post either main or io thread, based on |filter_|. > The > > choice is then stored as |encode_task_runner_| where this is posted. It is > > invalidated on io if there is |filter_|, or on main(dtor) otherwise. > > Please document this in the header file, the current comment about VideoFrames > is not as clear. Done. https://codereview.chromium.org/2849443003/diff/80001/media/gpu/ipc/service/g... File media/gpu/ipc/service/gpu_video_encode_accelerator.cc (right): https://codereview.chromium.org/2849443003/diff/80001/media/gpu/ipc/service/g... media/gpu/ipc/service/gpu_video_encode_accelerator.cc:174: weak weak_this_factory_for_encoder_worker_(this), On 2017/04/28 18:22:44, sandersd wrote: > Presumably does not compile. Done.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by emircan@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from sandersd@chromium.org Link to the patchset: https://codereview.chromium.org/2849443003/#ps120001 (title: " ")
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 120001, "attempt_start_ts": 1493658867198150, "parent_rev": "221e92f4f397ace9c60dd7361c306e7f7a1c4851", "commit_rev": "a561de6d59f43481c46e61a34508fa15c5fd2abd"}
Message was sent while issue was closed.
Description was changed from ========== Fix errors in destruction sequence of GpuVideoEncodeAccelerator::OnWillDestroyStub() On Windows, we can use GPU IO thread to filter some messages for GPUVEA. In that case, while GpuVideoEncodeAccelerator::OnWillDestroyStub() is running on main thread, GpuVideoEncodeAccelerator::OnEncodeFrameCreated() can run on IO thread. If |encoder_| is reset on main thread and accessed on IO thread, we see the crashes listed on the bug. This CL solves the issue by: - Checking |filter_removed_| which is signaled on IO thread before deciding to continue with encode GpuVideoEncodeAccelerator::OnEncodeFrameCreated() on IO thread. - Making sure that |encoder_worker_thread_| tasks are completed before reset. BUG=715759 TEST=Tested AppRTC loopback with H264. 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 ========== to ========== Fix errors in destruction sequence of GpuVideoEncodeAccelerator::OnWillDestroyStub() On Windows, we can use GPU IO thread to filter some messages for GPUVEA. In that case, while GpuVideoEncodeAccelerator::OnWillDestroyStub() is running on main thread, GpuVideoEncodeAccelerator::OnEncodeFrameCreated() can run on IO thread. If |encoder_| is reset on main thread and accessed on IO thread, we see the crashes listed on the bug. This CL solves the issue by: - Checking |filter_removed_| which is signaled on IO thread before deciding to continue with encode GpuVideoEncodeAccelerator::OnEncodeFrameCreated() on IO thread. - Making sure that |encoder_worker_thread_| tasks are completed before reset. BUG=715759 TEST=Tested AppRTC loopback with H264. 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/2849443003 Cr-Commit-Position: refs/heads/master@{#468457} Committed: https://chromium.googlesource.com/chromium/src/+/a561de6d59f43481c46e61a34508... ==========
Message was sent while issue was closed.
Committed patchset #4 (id:120001) as https://chromium.googlesource.com/chromium/src/+/a561de6d59f43481c46e61a34508... |