question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Websocket nullpointerexceptions for subscribeTo

See original GitHub issue

Home Assistant Android version:

beta-2646-84aa4454

Android version:

12/13

Phone model:

Pixel 5

Home Assistant version:

unknown

Last working Home Assistant release (if known):

unknown

Description of problem:

3 very similar null pointer errors in Sentry for the latest beta in the play store

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:244)
    at io.homeassistant.companion.android.common.data.websocket.impl.WebSocketRepositoryImpl.subscribeToEventsForType(WebSocketRepositoryImpl.kt:189)
    at io.homeassistant.companion.android.common.data.websocket.impl.WebSocketRepositoryImpl.getStateChanges(WebSocketRepositoryImpl.kt:177)
    at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl.getEntityUpdates(IntegrationRepositoryImpl.kt:578)
    at io.homeassistant.companion.android.widgets.BaseWidgetProvider$onScreenOn$1.invokeSuspend(BaseWidgetProvider.kt:86)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    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:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7911)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1009)
java.lang.NullPointerException: null
    at io.homeassistant.companion.android.common.data.websocket.impl.WebSocketRepositoryImpl.subscribeTo(WebSocketRepositoryImpl.kt:244)
    at io.homeassistant.companion.android.common.data.websocket.impl.WebSocketRepositoryImpl.subscribeToEventsForType(WebSocketRepositoryImpl.kt:189)
    at io.homeassistant.companion.android.common.data.websocket.impl.WebSocketRepositoryImpl.getStateChanges(WebSocketRepositoryImpl.kt:177)
    at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl.getEntityUpdates(IntegrationRepositoryImpl.kt:578)
    at io.homeassistant.companion.android.controls.HaControlsProviderService$createPublisherFor$1$1$request$1$2.invokeSuspend(HaControlsProviderService.kt:160)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
    at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
java.lang.NullPointerException: null
    at io.homeassistant.companion.android.common.data.websocket.impl.WebSocketRepositoryImpl.subscribeTo(WebSocketRepositoryImpl.kt:244)
    at io.homeassistant.companion.android.common.data.websocket.impl.WebSocketRepositoryImpl.getTemplateUpdates(WebSocketRepositoryImpl.kt:192)
    at io.homeassistant.companion.android.common.data.integration.impl.IntegrationRepositoryImpl.getTemplateUpdates(IntegrationRepositoryImpl.kt:180)
    at io.homeassistant.companion.android.widgets.template.TemplateWidget$onScreenOn$1.invokeSuspend(TemplateWidget.kt:143)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    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:8663)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Screenshot of problem:

Additional information:

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jpelgromcommented, Sep 5, 2022

I suspect if its not widgets it may be the users who have persistent connection set to Screen On and never changed the setting.

The current stacktraces show widgets and device controls as the source. The persistent connection uses a different function to handle subscribing/unsubscribing (for now), so I would expect a slightly different stacktrace in that case, line 277 for beta-2646: https://github.com/home-assistant/android/blob/84aa4454b731e4058cce083d947c27a4d90c5469/common/src/main/java/io/homeassistant/companion/android/common/data/websocket/impl/WebSocketRepositoryImpl.kt#L277

1reaction
dshokouhicommented, Sep 5, 2022

I believe this is the result of changes in #2801 so the latest stable release should be fine, but if you do spot it in other versions please mention it @dshokouhi !

So far only in Beta 2646, lets see what happens after the next beta push on Saturday.

Also I think you are right about the race, most (if not all) of the events are related to screen turning on. I suspect if its not widgets it may be the users who have persistent connection set to Screen On and never changed the setting.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NullPointerException in Websockets - java - Stack Overflow
I'm implementing Websockets on a Tomcat 7 Server. When the client sends some parameters the server performs some tasks through the Updater ...
Read more >
SEC-2896: NullPointerException when trying to subscribe ...
I then try to subscribe to the channel so I can listen to messages. ... at org.springframework.web.socket.sockjs.transport.session.
Read more >
IJ11287: IGI 5.2.4.1 "UNEXPECTED ERROR" WHEN TRYING ...
APAR status. Closed as program error. Error description. IGI 5.2.4 FP1 "Unexpected Error" when trying to submit an entitlement request with account ...
Read more >
Null Pointer Exception When Open Websocket Connection
This exception occurs only during the process of making web socket connections. To Reproduce ... NullPointerException at io.ktor.server.netty.http1.
Read more >
WebSocket not Working on Apache Tomcat 7 on AWS ...
Websockets requires tomcat 7.0.47 or 8, also be sure you have JRE 7 one more thing check that your ELB configured at TCP/SSL...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found