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

Intermittent crashes near the start / end of episodes, during MediaSessionCompat.setMetadata() #2122

Closed
orionlee opened this issue Sep 15, 2016 · 5 comments

Comments

@orionlee
Copy link
Contributor

orionlee commented Sep 15, 2016


Workaround (Sep 29 2016):
If your device is entry level or has little memory, try disabling lockscreen background in the settings. Disabling lockscreen background probably would alleviate most of the problems.


Problem Summary:

  • When playing to near the end of episodes (or about to start the next one), Antennapod on my phone crashes intermittently but often enough (ballpark about 10% of time).
  • logcat indicated indicated OutOfMemory error (need to allocate 7.5Mb), but I believed the device still enough of memory at that point (device had at least 30Mb free memory, though I understand it does not necessarily mean they are available to antennapod).
  • The problem probably occurred around switching cover art OutOfMemoryError stacktrace shows it is triggered by Bitmap.nativeCopy() < ... ... < MediaSessionCompat.setMetadata() < antennapod...PlaybackService$$Lambda$2.run()
  • It happened irrespective of whether phone screen is on: in other words, if the error was indeed triggered by switching covert art, the cover art was not needed nor in display at all (from end user perspective) as the screen was off.

Any help would be appreciated. Thanks!


App version: 1.6.1.2 from Play (and later a Custom Release Build based on 1.6.1.2 with PR #2117)

Android version: 4.1.2

Devide model: Samsung Galaxy Exhibit T-599H

First occured: a few weeks ago when I first used AntennaPod (1.6.1.2)

Environment: [Settings you have changed, e.g. Auto Download. "Unusual" devices you use, e.g. Bluetooth headphones. Do you still use Prestissimo?]

Stacktrace/Logcat:
An excerpt:

09-11 18:47:00.620 D/dalvikvm(24137): GC_FOR_ALLOC freed 14K, 42% free 28768K/48903K, paused 109ms, total 109ms

09-11 18:47:00.620 I/dalvikvm-heap(24137): Forcing collection of SoftReferences for 7851220-byte allocation

09-11 18:47:00.720 D/dalvikvm(24137): GC_BEFORE_OOM freed 10K, 42% free 28757K/48903K, paused 102ms, total 102ms

09-11 18:47:00.720 E/dalvikvm-heap(24137): Out of memory on a 7851220-byte allocation.

09-11 18:47:00.720 I/dalvikvm(24137): "Thread-1570" prio=5 tid=19 RUNNABLE

09-11 18:47:00.720 I/dalvikvm(24137):   | group="main" sCount=0 dsCount=0 obj=0x43d1fcd8 self=0x52ed5fb8

09-11 18:47:00.720 I/dalvikvm(24137):   | sysTid=29570 nice=0 sched=3/0 cgrp=[no-cpu-subsys] handle=1336560304

09-11 18:47:00.720 I/dalvikvm(24137):   | schedstat=( 169799804 57342531 68 ) utm=16 stm=0 core=0

09-11 18:47:00.720 I/dalvikvm(24137):   at android.graphics.Bitmap.nativeCopy(Native Method)

09-11 18:47:00.730 I/dalvikvm(24137):   at android.graphics.Bitmap.copy(Bitmap.java:458)

09-11 18:47:00.730 I/dalvikvm(24137):   at android.support.v4.media.session.MediaSessionCompat$MediaSessionImplBase.cloneMetadataIfNeeded(MediaSessionCompat.java:1296)

09-11 18:47:00.730 I/dalvikvm(24137):   at android.support.v4.media.session.MediaSessionCompat$MediaSessionImplBase.setMetadata(MediaSessionCompat.java:1311)

09-11 18:47:00.730 I/dalvikvm(24137):   at android.support.v4.media.session.MediaSessionCompat.setMetadata(MediaSessionCompat.java:404)

09-11 18:47:00.730 I/dalvikvm(24137):   at de.danoeh.antennapod.core.service.playback.PlaybackService$$Lambda$2.run((null):2077)

09-11 18:47:00.730 I/dalvikvm(24137):   at java.lang.Thread.run(Thread.java:856)

09-11 18:47:00.730 I/dalvikvm(24137): 

09-11 18:47:00.730 W/dalvikvm(24137): threadid=19: thread exiting with uncaught exception (group=0x41ea22a0)

Before or after such error, there often are some ClassCastException from Integer to Long

09-11 18:47:00.750 W/Bundle  (29951): Key id expected Long but value was a java.lang.Integer.  The default value 0 was returned.

09-11 18:47:00.750 W/Bundle  (29951): Attempt to cast generated internal exception:

09-11 18:47:00.750 W/Bundle  (29951): java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

09-11 18:47:00.750 W/Bundle  (29951):   at android.os.Bundle.getLong(Bundle.java:973)

09-11 18:47:00.750 W/Bundle  (29951):   at android.content.Intent.getLongExtra(Intent.java:4385)

09-11 18:47:00.750 W/Bundle  (29951):   at com.samsung.avrcp.BtAvrcpHandler.onReceive(BtAvrcpHandler.java:155)

09-11 18:47:00.750 W/Bundle  (29951):   at android.app.ActivityThread.handleReceiver(ActivityThread.java:2262)

09-11 18:47:00.750 W/Bundle  (29951):   at android.app.ActivityThread.access$1600(ActivityThread.java:134)

09-11 18:47:00.750 W/Bundle  (29951):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)

09-11 18:47:00.750 W/Bundle  (29951):   at android.os.Handler.dispatchMessage(Handler.java:99)

09-11 18:47:00.750 W/Bundle  (29951):   at android.os.Looper.loop(Looper.java:137)

09-11 18:47:00.750 W/Bundle  (29951):   at android.app.ActivityThread.main(ActivityThread.java:4867)

09-11 18:47:00.750 W/Bundle  (29951):   at java.lang.reflect.Method.invokeNative(Native Method)

09-11 18:47:00.750 W/Bundle  (29951):   at java.lang.reflect.Method.invoke(Method.java:511)

09-11 18:47:00.750 W/Bundle  (29951):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)

09-11 18:47:00.750 W/Bundle  (29951):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)

09-11 18:47:00.750 W/Bundle  (29951):   at dalvik.system.NativeStart.main(Native Method)

09-11 18:47:00.750 W/Bundle  (29951): Key position expected Long but value was a java.lang.Integer.  The default value 0 was returned.

09-11 18:47:00.750 W/Bundle  (29951): Attempt to cast generated internal exception:

09-11 18:47:00.750 W/Bundle  (29951): java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

09-11 18:47:00.750 W/Bundle  (29951):   at android.os.Bundle.getLong(Bundle.java:973)

09-11 18:47:00.750 W/Bundle  (29951):   at android.content.Intent.getLongExtra(Intent.java:4385)

09-11 18:47:00.750 W/Bundle  (29951):   at com.samsung.avrcp.BtAvrcpHandler.onReceive(BtAvrcpHandler.java:162)

09-11 18:47:00.750 W/Bundle  (29951):   at android.app.ActivityThread.handleReceiver(ActivityThread.java:2262)

09-11 18:47:00.750 W/Bundle  (29951):   at android.app.ActivityThread.access$1600(ActivityThread.java:134)

09-11 18:47:00.750 W/Bundle  (29951):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)

09-11 18:47:00.750 W/Bundle  (29951):   at android.os.Handler.dispatchMessage(Handler.java:99)

09-11 18:47:00.750 W/Bundle  (29951):   at android.os.Looper.loop(Looper.java:137)

09-11 18:47:00.750 W/Bundle  (29951):   at android.app.ActivityThread.main(ActivityThread.java:4867)

09-11 18:47:00.750 W/Bundle  (29951):   at java.lang.reflect.Method.invokeNative(Native Method)

09-11 18:47:00.750 W/Bundle  (29951):   at java.lang.reflect.Method.invoke(Method.java:511)

09-11 18:47:00.750 W/Bundle  (29951):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)

09-11 18:47:00.750 W/Bundle  (29951):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)

09-11 18:47:00.750 W/Bundle  (29951):   at dalvik.system.NativeStart.main(Native Method)

09-11 18:47:00.770 E/AndroidRuntime(24137): FATAL EXCEPTION: Thread-1570

09-11 18:47:00.770 E/AndroidRuntime(24137): java.lang.OutOfMemoryError

09-11 18:47:00.770 E/AndroidRuntime(24137):     at android.graphics.Bitmap.nativeCopy(Native Method)

09-11 18:47:00.770 E/AndroidRuntime(24137):     at android.graphics.Bitmap.copy(Bitmap.java:458)

09-11 18:47:00.770 E/AndroidRuntime(24137):     at android.support.v4.media.session.MediaSessionCompat$MediaSessionImplBase.cloneMetadataIfNeeded(MediaSessionCompat.java:1296)

09-11 18:47:00.770 E/AndroidRuntime(24137):     at android.support.v4.media.session.MediaSessionCompat$MediaSessionImplBase.setMetadata(MediaSessionCompat.java:1311)

09-11 18:47:00.770 E/AndroidRuntime(24137):     at android.support.v4.media.session.MediaSessionCompat.setMetadata(MediaSessionCompat.java:404)

09-11 18:47:00.770 E/AndroidRuntime(24137):     at de.danoeh.antennapod.core.service.playback.PlaybackService$$Lambda$2.run(Unknown Source)

09-11 18:47:00.770 E/AndroidRuntime(24137):     at java.lang.Thread.run(Thread.java:856)

09-11 18:47:00.810 E/android.os.Debug( 2016): !@Dumpstate > dumpstate -k -t -z -d -o /data/log/dumpstate_app_error

09-11 18:47:00.830 I/dumpstate(29574): begin

......
@mfietz
Copy link
Contributor

mfietz commented Sep 15, 2016

Quick fix: Turn off the lockscreen background

Images need huge amounts of memory and older phones often do not have that.

@orionlee
Copy link
Contributor Author

@mfietz Thanks for the quick response. I was about to say I had lockscreen background disabled, but I double-checked it and found it was indeed enabled. I will try out to have lockscreen background disabled, and update later, to see if this is indeed the issue (and the workaround).

@orionlee
Copy link
Contributor Author

@mfietz The workaround (disable lockscreen background) resolved most of the crashes. Thanks!

I still got (a few times) crashes with the Key id expected Long but value was a java.lang.Integer. The default value 0 was returned. error. If it persists (and recurring enough) I will log it separately.

@orionlee
Copy link
Contributor Author

orionlee commented Oct 1, 2016

I logged the separate crashes with Key id expected Long but value as a java.lang.Integer error in #2134

@Bigpet
Copy link

Bigpet commented Oct 10, 2016

@orionlee does Bigpet@7dd21c7 catch this without crashing ? Build an apk with it at https://www.petertissen.de/temp_files/app-play-release.apk if you don't want to build it yourself.

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

No branches or pull requests

3 participants