Skip to content

Conversation

@bitsandfoxes
Copy link
Contributor

Resolves #2380

The issue and provided logs detail that during startup the application crashes with a StackOverflowError and the following callstack

\tat com.oculus.xrinput.client.InputHooks.onWindowFocusChanged(:4)\
\tat io.sentry.android.core.internal.gestures.WindowCallbackAdapter.onWindowFocusChanged(WindowCallbackAdapter.java:95)\
\tat com.oculus.xrinput.client.InputHooks.onWindowFocusChanged(:4)\
\tat io.sentry.android.core.internal.gestures.WindowCallbackAdapter.onWindowFocusChanged(WindowCallbackAdapter.java:95)\
\tat com.oculus.xrinput.client.InputHooks.onWindowFocusChanged(:4)\
\tat io.sentry.android.core.internal.gestures.WindowCallbackAdapter.onWindowFocusChanged(WindowCallbackAdapter.java:95)\
\tat com.oculus.xrinput.client.InputHooks.onWindowFocusChanged(:4)\
\tat io.sentry.android.core.internal.gestures.WindowCallbackAdapter.onWindowFocusChanged(WindowCallbackAdapter.java:95)\
\tat com.oculus.xrinput.client.InputHooks.onWindowFocusChanged(:4)\
\tat io.sentry.android.core.internal.gestures.WindowCallbackAdapter.onWindowFocusChanged(WindowCallbackAdapter.java:95)\
\tat com.oculus.xrinput.client.InputHooks.onWindowFocusChanged(:4)\
\tat com.android.internal.policy.DecorView.onWindowFocusChanged(DecorView.java:1788)\
\tat android.view.View.dispatchWindowFocusChanged(View.java:15944)\
\tat android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1510)\
\tat android.view.ViewRootImpl.dispatchFocusEvent(ViewRootImpl.java:4189)\
\tat android.view.ViewRootImpl.handleWindowFocusChanged(ViewRootImpl.java:4093)\
\tat android.view.ViewRootImpl.-$$Nest$mhandleWindowFocusChanged(Unknown Source:0)\
\tat android.view.ViewRootImpl$ViewRootHandler.handleMessageImpl(ViewRootImpl.java:6144)\
\tat android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:6052)\
\tat android.os.Handler.dispatchMessage(Handler.java:106)\
\tat android.os.Looper.loopOnce(Looper.java:218)\
\tat android.os.Looper.loop(Looper.java:310)\
\tat android.app.ActivityThread.main(ActivityThread.java:8258)\
\tat java.lang.reflect.Method.invoke(Native Method)\
\tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)\
\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)

So it recurses in onWindowFocusChanged with io.sentry.android.core.internal.gestures.WindowCallbackAdapter.onWindowFocusChanged maybe being my red herring right now.

The closes I got tho a root cause is this:

  1. UserInteractionIntegration gets enabled (enabled by default and not explicitely disabled by the Unity SDK)
  2. WindowCallback wrapping is installed: The integration wraps the Activity's Window.Callback with SentryWindowCallback
  3. Recursive loop on Oculus: On Oculus Quest devices, the InputHooks also wrap Window.Callback. Then, when onWindowFocusChanged() is called we have
    DecorView → Oculus: InputHooks → Sentry: WindowCallback → back to InputHooks → infinite recursion → StackOverflowError

The neat part is that we don't actually get any breadcrumbs out of this in our Unity game. So we can safely out-out of these integrations without losing anything.

I'll have to try to reproduce this on the actual Quest.

@bitsandfoxes bitsandfoxes marked this pull request as ready for review November 6, 2025 18:18
@bitsandfoxes bitsandfoxes requested review from a team and romtsn November 6, 2025 18:19
Copy link
Member

@JoshuaMoelans JoshuaMoelans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

smol typo, but otherwise LGTM

Co-authored-by: JoshuaMoelans <60878493+JoshuaMoelans@users.noreply.github.com>
@bitsandfoxes bitsandfoxes merged commit d3e24c7 into main Nov 7, 2025
9 of 14 checks passed
@bitsandfoxes bitsandfoxes deleted the fix/occulus-quest-crashes branch November 7, 2025 11:51
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Fixes

- Disable native interaction breadcrumb and tracing when targeting Android ([#2393](https://github.com/getsentry/sentry-unity/pull/2393))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against 758f977

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRITICAL: Application crash on startup from StackOverflowError

4 participants