[Presentation API] PresentationConnection.onconnect event handler sometimes not called due to a race condition |
|||||||||
Issue descriptionMoved here from b/34103696. Observed on macOS (Beta 56, Canary 57, TOT) and Linux (Beta 56, Dev 57) There is a race condition between PresentationController::registerConnection() and PresentationController::didChangeSessionState(). When didChangeSessionState() gets called before registerConnection(), it's a no-op, and results in the onconnect event not firing.
,
Jan 24 2017
,
Jan 24 2017
,
Jan 26 2017
,
Jan 26 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1ebdd16432860b90eaaeaba7042c2e9761b17ef7 commit 1ebdd16432860b90eaaeaba7042c2e9761b17ef7 Author: imcheng <imcheng@chromium.org> Date: Thu Jan 26 22:01:52 2017 [Presentation API] Fix race condition in which state change is lost. Currently there is a race condition between the PresentationConnection being returned to PresentationDispatcher on a successful start() or reconnect(), and PresentationDispatcher being notified by the browser that the state change has become connected. Although PresentationServiceImpl issues the state change strictly after executing the callback returning the PresentationConnection, it appears that they are using distinct independent message pipes, which do not guarantee order of arrival between these two messages. If the state change message arrives first, then it will be lost due to the connection not yet registered with Blink at that point in time. The fix here is to change state to connected in Blink, after the PresentationConnection is registered. This fix needs to be merged back to 57. Additional test assertions will be in a followup patch. BUG= 684664 Review-Url: https://codereview.chromium.org/2653683006 Cr-Commit-Position: refs/heads/master@{#446465} [modify] https://crrev.com/1ebdd16432860b90eaaeaba7042c2e9761b17ef7/content/browser/presentation/presentation_service_impl.cc [modify] https://crrev.com/1ebdd16432860b90eaaeaba7042c2e9761b17ef7/content/browser/presentation/presentation_service_impl.h [modify] https://crrev.com/1ebdd16432860b90eaaeaba7042c2e9761b17ef7/content/browser/presentation/presentation_service_impl_unittest.cc [modify] https://crrev.com/1ebdd16432860b90eaaeaba7042c2e9761b17ef7/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
,
Jan 30 2017
Derek is this fixed? Can you verify in Canary so we can request a merge to M57?
,
Jan 30 2017
Issue 655840 has been merged into this issue.
,
Jan 30 2017
I just verified it works in canary 58.0.2995.0.
,
Jan 30 2017
[Auto-generated comment by a script] We noticed that this issue is targeted for M-57; it appears the fix may have landed after branch point, meaning a merge might be required. Please confirm if a merge is required here - if so add Merge-Request-57 label, otherwise remove Merge-TBD label. Thanks.
,
Jan 30 2017
,
Jan 30 2017
Your change meets the bar and is auto-approved for M57. Please go ahead and merge the CL to branch 2987 manually. Please contact milestone owner if you have questions. Owners: amineer@(clank), cmasso@(bling), ketakid@(cros), govind@(desktop) For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jan 30 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/cdf4402738b87ca888eb12baa02d1b78bd396b4a commit cdf4402738b87ca888eb12baa02d1b78bd396b4a Author: Derek Cheng <imcheng@chromium.org> Date: Mon Jan 30 22:16:55 2017 [Presentation API] Fix race condition in which state change is lost. Currently there is a race condition between the PresentationConnection being returned to PresentationDispatcher on a successful start() or reconnect(), and PresentationDispatcher being notified by the browser that the state change has become connected. Although PresentationServiceImpl issues the state change strictly after executing the callback returning the PresentationConnection, it appears that they are using distinct independent message pipes, which do not guarantee order of arrival between these two messages. If the state change message arrives first, then it will be lost due to the connection not yet registered with Blink at that point in time. The fix here is to change state to connected in Blink, after the PresentationConnection is registered. This fix needs to be merged back to 57. Additional test assertions will be in a followup patch. BUG= 684664 Review-Url: https://codereview.chromium.org/2653683006 Cr-Commit-Position: refs/heads/master@{#446465} (cherry picked from commit 1ebdd16432860b90eaaeaba7042c2e9761b17ef7) Review-Url: https://codereview.chromium.org/2661053002 . Cr-Commit-Position: refs/branch-heads/2987@{#198} Cr-Branched-From: ad51088c0e8776e8dcd963dbe752c4035ba6dab6-refs/heads/master@{#444943} [modify] https://crrev.com/cdf4402738b87ca888eb12baa02d1b78bd396b4a/content/browser/presentation/presentation_service_impl.cc [modify] https://crrev.com/cdf4402738b87ca888eb12baa02d1b78bd396b4a/content/browser/presentation/presentation_service_impl.h [modify] https://crrev.com/cdf4402738b87ca888eb12baa02d1b78bd396b4a/content/browser/presentation/presentation_service_impl_unittest.cc [modify] https://crrev.com/cdf4402738b87ca888eb12baa02d1b78bd396b4a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
,
Jan 31 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/54e7828cdcb38fda68c7a5bbc7ea1d7896f96588 commit 54e7828cdcb38fda68c7a5bbc7ea1d7896f96588 Author: imcheng <imcheng@chromium.org> Date: Tue Jan 31 03:59:32 2017 [MR tests] Assert initial state / state change for reconnect case. Followup to https://codereview.chromium.org/2653683006/. Refactor logic that asserts initial state of a PresentationConnection into a helper method and also use it in the reconnect success case. BUG= 684664 Review-Url: https://codereview.chromium.org/2654003002 Cr-Commit-Position: refs/heads/master@{#447184} [modify] https://crrev.com/54e7828cdcb38fda68c7a5bbc7ea1d7896f96588/chrome/test/media_router/resources/common.js |
|||||||||
►
Sign in to add a comment |
|||||||||
Comment 1 by sko...@chromium.org
, Jan 24 2017Status: Available (was: Untriaged)