Subsonic icon indicating copy to clipboard operation
Subsonic copied to clipboard

5.4.2: Crash when device is entering stand-by

Open nRaecheR opened this issue 7 years ago • 12 comments

After updating to version 5.4.2 on all my devices DSub crashes when the device goes to stand-by while playing a song. Here's the stacktrace after the crash:

Android API level: 26
Subsonic version name: 5.4.2
Subsonic version code: 199

java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 1218196 bytes
	at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4255)
	at android.os.Handler.handleCallback(Handler.java:789)
	at android.os.Handler.dispatchMessage(Handler.java:98)
	at android.os.Looper.loop(Looper.java:180)
	at android.app.ActivityThread.main(ActivityThread.java:6950)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:835)
Caused by: android.os.TransactionTooLargeException: data parcel size 1218196 bytes
	at android.os.BinderProxy.transactNative(Native Method)
	at android.os.BinderProxy.transact(Binder.java:756)
	at android.app.IActivityManager$Stub$Proxy.activityStopped(IActivityManager.java:4660)
	at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4247)
	... 7 more

Both devices are running Android 8.0, one is a HTC 11 phone, the other is a tablet (Samsung Galaxy Tab S3). It seems after the initial crash the app won't crash anymore when I resume playback.

Never had this issue with any of the previous versions of DSub.

nRaecheR avatar Sep 03 '18 08:09 nRaecheR

Can you try the apk I linked over in https://github.com/daneren2005/Subsonic/issues/880 to see if that fixes your issue?

daneren2005 avatar Sep 03 '18 22:09 daneren2005

I would like to but it is a link to Dropbox which I cannot access. Do you have a version of the APK hosted on a trustworthy server?

nRaecheR avatar Sep 04 '18 05:09 nRaecheR

Why would you not be able to access it from Dropbox? It is a signed APK, so unless they figured out my signature as well, they can't modify it. I can't upload it here because Github won't let me upload them in comments.

daneren2005 avatar Sep 04 '18 18:09 daneren2005

I was having the same issue and tried the apk you linked, but now it crashes 5 seconds after opening the app every time. Here is the stacktrace, looks like you need to call service.startForeground within 5 seconds of calling startForegroundService.

Android API level: 26 Subsonic version name: 5.4.2 Subsonic version code: 199

android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground() at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1881) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6938) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)

kooper100 avatar Sep 07 '18 16:09 kooper100

Looks like there were more changes introduced in Android O I didn't know about. Try this one out: https://www.dropbox.com/s/r0mzo7zk9no76xi/DSub%205.4.2-service-crash-fix2.apk?dl=0

daneren2005 avatar Sep 08 '18 00:09 daneren2005

Yup that seems to fix it for me.

Thanks! Appreciate the work you put it!

kooper100 avatar Sep 08 '18 00:09 kooper100

I think you'll need to re-open this bug, it is still present in 5.4.3:

Android API level: 26
Subsonic version name: 5.4.3
Subsonic version code: 200

java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 1218228 bytes
	at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4255)
	at android.os.Handler.handleCallback(Handler.java:789)
	at android.os.Handler.dispatchMessage(Handler.java:98)
	at android.os.Looper.loop(Looper.java:180)
	at android.app.ActivityThread.main(ActivityThread.java:6950)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:835)
Caused by: android.os.TransactionTooLargeException: data parcel size 1218228 bytes
	at android.os.BinderProxy.transactNative(Native Method)
	at android.os.BinderProxy.transact(Binder.java:756)
	at android.app.IActivityManager$Stub$Proxy.activityStopped(IActivityManager.java:4660)
	at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4247)
	... 7 more

nRaecheR avatar Sep 12 '18 05:09 nRaecheR

And another one:

Android API level: 26
Subsonic version name: 5.4.3
Subsonic version code: 200

android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground()
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1844)
	at android.os.Handler.dispatchMessage(Handler.java:105)
	at android.os.Looper.loop(Looper.java:180)
	at android.app.ActivityThread.main(ActivityThread.java:6950)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:835)

nRaecheR avatar Sep 12 '18 08:09 nRaecheR

I for the life of me can't figure this out, so I am reverting back to target SDK 23 for the time being.

daneren2005 avatar Sep 28 '18 00:09 daneren2005

It seems this issue is still a problem. Stacktrace follows. I have a large number of music files on my server. Maybe it could be caused by saving too much state? App seems to be able to fetch metadata, playlists, etc. from my server, but hangs when fetching a song.

Android API level: 29 Subsonic version name: 5.5.1 Subsonic version code: 205

java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 2445716 bytes at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:161) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7710) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) Caused by: android.os.TransactionTooLargeException: data parcel size 2445716 bytes at android.os.BinderProxy.transactNative(Native Method) at android.os.BinderProxy.transact(BinderProxy.java:557) at android.app.IActivityTaskManager$Stub$Proxy.activityStopped(IActivityTaskManager.java:4564) at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:145) ... 7 more

rpridemore avatar Dec 17 '20 21:12 rpridemore

I've removed those 3 lines from code

image Issue not persist.

I've minimized the app - no crash anymore, music still plays. Tracks are changed in background correctly, playlist is not "lost". When I've reopened the app, the only issue I saw it's that app not reopens same view - it opened Playlist instead of NowPlayingView. The tracks on Playlist have outdated download states (they're shown as not downloaded but I see in logcat they are). But I can still reopen that NowPlayingView by one click and I see correct track states there. That issue with tracks states seems to be much smaller than just an app crash.

I think it's safe to ignore that part of state.

I'm gonna leave that change in my phone, I don't know if someone still maintains this project :(

thecyberd3m0n avatar Mar 09 '24 11:03 thecyberd3m0n

I've removed those 3 lines from code I've minimized the app - no crash anymore, music still plays. Tracks are changed in background correctly, playlist is not "lost". When I've reopened the app, the only issue I saw it's that app not reopens same view - it opened Playlist instead of NowPlayingView. The tracks on Playlist have outdated download states (they're shown as not downloaded but I see in logcat they are). But I can still reopen that NowPlayingView by one click and I see correct track states there. That issue with tracks states seems to be much smaller than just an app crash.

I think it's safe to ignore that part of state.

I'm gonna leave that change in my phone, I don't know if someone still maintains this project :(

This is great! It seems far preferable than having the constant crashing. Are you able to share the fixed apk somehow?

johnbbbbbb avatar Mar 22 '24 19:03 johnbbbbbb