android icon indicating copy to clipboard operation
android copied to clipboard

Unbalanced entry/exit sentry crash

Open dshokouhi opened this issue 1 year ago • 9 comments

Home Assistant Android version: Latest master, first seen Beta 1882

Android version:

12

Phone model:

Pixel 5

Home Assistant version:

unknown

Last working Home Assistant release (if known):

N/A

Description of problem:

The below sentry error has many events being triggered. I am unsure when this situation occurs

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

java.lang.IllegalStateException: Unbalanced enter/exit
    at okio.AsyncTimeout.enter(AsyncTimeout.kt:49)
    at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:329)
    at okio.RealBufferedSource.indexOf(RealBufferedSource.kt:427)
    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:320)
    at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
    at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:178)
    at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
    at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
    at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
    at java.lang.Thread.run(Thread.java:920)

Screenshot of problem:

Additional information:

dshokouhi avatar Aug 08 '22 15:08 dshokouhi

Hope this information helps: my wife and I also get the same crash on our Galaxy S9+ (we each have one). I focused more keenly on this because I'm just beginning to troubleshoot an issue with high data consumption that I believe is unrelated, but wanted to mention "just in case".

I was surprised to see that my log is identical up to the last line, where her most recent is one digit off as below:

	at java.lang.Thread.run(Thread.java:919)

Home Assistant Android version: 2022.6.0-full

Android Version: 10

Phone Model: Samsung Galaxy S9+ (Verizon) SM-G965U

Feel free to ask if there's more information I can share; I will respond if I'm able.

pem884 avatar Aug 09 '22 18:08 pem884

@pem884 thank you for commenting here!

I'm just beginning to troubleshoot an issue with high data consumption that I believe is unrelated

There is a known issue where camera streams do not stop. To prevent that do not use live view cameras and make sure to navigate away from a camera stream before navigating away from the app. More details can be found in: https://github.com/home-assistant/android/issues/979

I was surprised to see that my log is identical up to the last line, where her most recent is one digit off as below:

a different line number here is fine, probably a difference in android versions as this bug took the stacktrace from a Pixel 5

Feel free to ask if there's more information I can share; I will respond if I'm able.

Could you let us know in what instances you notice this error? Does it just happen randomly in the background and things stop updating? What symptoms do you see as a result of it? As of now we only know about the error but not the cause of the error or its symptoms. I imagine the app gets killed and sensor updates stop?

Edit: what do the logs look like above this error?

dshokouhi avatar Aug 09 '22 21:08 dshokouhi

Thank you for the notes and the link to the other issue!

Could you let us know in what instances you notice this error? Does it just happen randomly in the background and things stop updating? What symptoms do you see as a result of it?

I'll pay closer attention; so far it seems to happen randomly in the background. I haven't paid attention yet to any symptoms, so I'll look out for that.

what do the logs look like above this error?

I think you are asking about the whole log, not just the crash log, right?:

  • The "regular" log that I got from Show and Share Logs starts after the error, after I started the app again to view the logs (I was kind of surprised, maybe I missed something?)
  • The crash log is identical to the one you posted except for timestamp and the :919 - but I listed it below just in case; let me know if it's too cluttered and I'll be happily to cut it out.
2022-08-09 13:45:02.737: java.lang.IllegalStateException: Unbalanced enter/exit
	at okio.AsyncTimeout.enter(AsyncTimeout.kt:49)
	at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:329)
	at okio.RealBufferedSource.indexOf(RealBufferedSource.kt:427)
	at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.kt:320)
	at okhttp3.internal.http1.HeadersReader.readLine(HeadersReader.kt:29)
	at okhttp3.internal.http1.Http1ExchangeCodec.readResponseHeaders(Http1ExchangeCodec.kt:178)
	at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
	at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
	at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
	at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:919)

And the "main" log doesn't begin until:

--------- beginning of main
08-09 13:47:43.580 16946 16946

(etc)

pem884 avatar Aug 09 '22 23:08 pem884

Oh I see so this showed up in the Recent Crash tab in the app correct? I thought you may have gotten it from another method like Logcat Reader which keeps historical logcat data. Thanks for letting us know it happens in the background, thats helpful.

dshokouhi avatar Aug 10 '22 00:08 dshokouhi

One more question, can you let us know if you have any widgets on these devices?

dshokouhi avatar Aug 10 '22 00:08 dshokouhi

Oh I see so this showed up in the Recent Crash tab in the app correct?

Yes, exactly right!

One more question, can you let us know if you have any widgets on these devices?

Indeed I do, I think the HA ones are all Service Call widgets. I'm happy to share any more information you need about those.

pem884 avatar Aug 11 '22 22:08 pem884

I'm happy to share any more information you need about those.

So you dont have any Entity State, Media Player or Template widgets from the app? What about your Persistent Connection settings is it something other than never ?

dshokouhi avatar Aug 16 '22 16:08 dshokouhi

I get the exact same error on line 919 at java.lang.Thread.run(Thread.java:919)

It happens on launch of the App or while interacting with the App, I haven't noticed it crashing in the background

It often happens while using the map card, but that may just be a coincidence

DragonHunter274 avatar Aug 28 '22 16:08 DragonHunter274

It happens on launch of the App

Interesting you get it on launch? What do the companion app logs look like above the error when it happens? That might give us a better clue if we can see if something else fails or tries just above it. Assuming that the app crashes when this happens we may need to use another app like Logcat Reader to get the logs.

It often happens while using the map card, but that may just be a coincidence

are there any other cards on that same view?

dshokouhi avatar Sep 09 '22 15:09 dshokouhi