New issue
Advanced search Search tips

Issue 723292 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Dec 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug
Proj-XR



Sign in to add a comment

Potential deadlock in VRDisplay::submitFrame

Reported by artyo...@gmail.com, May 17 2017

Issue description

Steps to reproduce the problem:
Seems like VRDisplay::submitFrame may got to deadlock in the case if OnSumbitFrameTransferred \ OnSubmitFrameComplete is not called for some reasons (for example, during the VrShell shutdown).

What is the expected behavior?
Shouldn't deadlock.

What went wrong?
I think, VRSubmitFrameClient should have method OnSubmitFrameAborted that would be called from VrShellGl::ForceExitVr and that will set both pending_previous_frame_render_ and pending_submit_frame_ to false. 

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: M60 master  Channel: dev
OS Version: 
Flash Version:
 

Comment 1 by klausw@chromium.org, May 17 2017

Labels: Proj-VR
Status: Started (was: Unconfirmed)
This is a bit subtle, WaitForIncomingMethodCall is basically a re-entrant activation of the mojo event loop. The current behavior seems to be that it also processes other events, so shutting down VrShell while it's waiting should set the variables to false via StopPresenting. 

It's unfortunately not very well documented, though one comment makes the re-entrancy assumption explicitly:

https://cs.chromium.org/chromium/src/mojo/public/cpp/bindings/lib/connector.cc?type=cs&l=203
      // Users that call WaitForIncomingMessage() should expect their code to be
      // re-entered, so we call the error handler synchronously.

I agree that OnSubmitFrameAborted or equivalent would be useful here to make this clearer.

Comment 2 by artyo...@gmail.com, May 18 2017

Oh, you know what could happen: I used singleprocess mode (for debugging). In this case, it seems like mojo's reenterancy may suffer. It does not allow OnExitPresent to be received until sumbitFrame is finished. At least this is what I observed. However, I have to admit that I am running this code with M57 (146), assumed (probably, incorrectly) that M60 didn't change much in this area.

Comment 3 by klausw@chromium.org, May 18 2017

Interesting, even in single process mode I'd assume it would still use separate threads. The problem may be that the other side of the IPC connection isn't getting scheduled, not the reentrancy as such.

For the record, what build options and runtime options are you using for this singleprocess mode? Fixing this would be low priority, but would be good to understand what's happening.

Comment 4 by artyo...@gmail.com, May 18 2017

It could be. And OnSubmitFrameAborted solves the issue anyway ;)
As to singleprocess mode: it is EXTREMELY helpful for debugging. I use Android Studio as a debugger and it works well with singleprocess Chromium. I had to do several relatively small tweaks (hacks, to be precise) to make it work, tho:
1) mojo/public/cpp/bindings/lib/binding_state.cc, BindingStateBase::BindInternal: I had to comment out the check "DCHECK(!router_);", for some reasons it fails in SP-mode.
2) content/browser/renderer_host/render_process_host_impl.cc, RenderProcessHostImpl::IsSuitableHost: removed the check "DCHECK_EQ(host->GetBrowserContext(), browser_context)"
3) content/browser/renderer_host/context_provider_factory_impl_android.cc, ContextProviderFactoryImpl::OnGpuChannelTimeout(): replace LOG(FATAL) by LOG(ERROR) there (don't actually remember why exactly that was an issue, though).
4) I've also added 'enforce_singleprocess' option into args.gn, that effectively forces to append the switch kSingleProcess switch to parsed_command_line in /content/browser/android/content_startup_flags.cc.

Unless I forgot something, this is pretty much it. I've also created a doc on how to setup Android Studio for debugging Chromium, let me know if you are interested.
Owner: klausw@chromium.org
Status: Unconfirmed (was: Started)
Klaus, is there anything actionable here? If not, I think we should close this.

Comment 6 by bshe@chromium.org, Dec 7 2017

friendly ping? Klaus, should we close this bug or do you prefer to keep it open?
Status: WontFix (was: Unconfirmed)
Let's close this out as WAI, this isn't an issue in production builds and needed a modified build using single process mode to reproduce. And even in that case, I think arguably that would be a bug in mojo scheduling.

Single process mode does sound potentially useful for debugging, but we should track that separately if it's something we'd be interested in enabling.
Labels: Test-Complete
Components: Blink>WebXR

Sign in to add a comment