Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry error: Null Pointer Exception for subscribeTo state changes #2889

Closed
dshokouhi opened this issue Sep 16, 2022 · 3 comments · Fixed by #2892
Closed

Sentry error: Null Pointer Exception for subscribeTo state changes #2889

dshokouhi opened this issue Sep 16, 2022 · 3 comments · Fixed by #2892
Labels
bug Something isn't working

Comments

@dshokouhi
Copy link
Member

Home Assistant Android version:

beta-2692

Android version:

12

Phone model:

SM-F936U1

Home Assistant version:

unknown

Last working Home Assistant release (if known):

unknown

Description of problem:

Found the following sentry error that started to show up in the latest beta in the play store, not impacting too many users but more than just a few.

Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):

java.lang.NullPointerException: null
    at io.homeassistant.companion.android.common.data.websocket.impl.WebSocketRepositoryImpl.subscribeTo(WebSocketRepositoryImpl.kt:256)
    at io.homeassistant.companion.android.common.data.websocket.impl.WebSocketRepositoryImpl.subscribeToTrigger(WebSocketRepositoryImpl.kt:203)
    at io.homeassistant.companion.android.common.data.websocket.impl.WebSocketRepositoryImpl.getStateChanges(WebSocketRepositoryImpl.kt:182)
    at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl.getEntityUpdates(IntegrationRepositoryImpl.kt:615)
    at io.homeassistant.companion.android.widgets.BaseWidgetProvider$onScreenOn$1.invokeSuspend(BaseWidgetProvider.kt:108)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
    at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8855)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Screenshot of problem:

Additional information:

@dshokouhi dshokouhi added the bug Something isn't working label Sep 16, 2022
@dshokouhi dshokouhi changed the title Sentry error: Null Pointer Exception for subscribeto state changes Sentry error: Null Pointer Exception for subscribeTo state changes Sep 16, 2022
@jpelgrom
Copy link
Member

Another race condition? Guess the changes in #2855 weren't enough... I'm tempted to just remove the !! to prevent crashes.

@dshokouhi
Copy link
Member Author

yea this one got triggered when the screen turned on as well

@jpelgrom
Copy link
Member

Managed to reproduce this by introducing an artificial delay right before this line. I'm not sure how realistic it is, but the flow isn't removed anywhere else. The device would have to be sending an unsubscribe, which sets the flow to null, and almost immediately resubscribe before the ID is removed in the next line - maybe the system isn't sending the screen off intent immediately or suspending the app too soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants