Closed Bug 702365 Opened 13 years ago Closed 13 years ago

Large screenshot can cause OOM on startup

Categories

(Firefox for Android Graveyard :: General, defect, P1)

ARM
Android
defect

Tracking

(fennec11+)

RESOLVED DUPLICATE of bug 708961
Tracking Status
fennec 11+ ---

People

(Reporter: pcwalton, Assigned: dougt)

References

Details

(Keywords: crash, reproducible, Whiteboard: [native-crash:P1])

Attachments

(1 file)

Seen on a Galaxy Tab.

E/dalvikvm-heap( 2369): Out of memory on a 33554448-byte allocation.
I/dalvikvm( 2369): "main" prio=5 tid=1 RUNNABLE
I/dalvikvm( 2369):   | group="main" sCount=0 dsCount=0 obj=0x402805a8 self=0x12690
I/dalvikvm( 2369):   | sysTid=2369 nice=0 sched=0/0 cgrp=default handle=-1342909336
I/dalvikvm( 2369):   | schedstat=( 573428000 86600000 448 ) utm=49 stm=8 core=1
I/dalvikvm( 2369):   at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
I/dalvikvm( 2369):   at java.nio.MemoryBlock.allocate(MemoryBlock.java:92)
I/dalvikvm( 2369):   at java.nio.ReadWriteDirectByteBuffer.<init>(ReadWriteDirectByteBuffer.java:46)
I/dalvikvm( 2369):   at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:67)
I/dalvikvm( 2369):   at org.mozilla.gecko.gfx.PlaceholderLayerClient.<init>(PlaceholderLayerClient.java:71)
I/dalvikvm( 2369):   at org.mozilla.gecko.gfx.PlaceholderLayerClient.createInstance(PlaceholderLayerClient.java:83)
I/dalvikvm( 2369):   at org.mozilla.gecko.GeckoApp.onCreate(GeckoApp.java:1050)
I/dalvikvm( 2369):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
I/dalvikvm( 2369):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1715)
I/dalvikvm( 2369):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1767)
I/dalvikvm( 2369):   at android.app.ActivityThread.access$1500(ActivityThread.java:122)
I/dalvikvm( 2369):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1005)
I/dalvikvm( 2369):   at android.os.Handler.dispatchMessage(Handler.java:99)
I/dalvikvm( 2369):   at android.os.Looper.loop(Looper.java:132)
I/dalvikvm( 2369):   at android.app.ActivityThread.main(ActivityThread.java:4028)
I/dalvikvm( 2369):   at java.lang.reflect.Method.invokeNative(Native Method)
I/dalvikvm( 2369):   at java.lang.reflect.Method.invoke(Method.java:491)
I/dalvikvm( 2369):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
I/dalvikvm( 2369):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
I/dalvikvm( 2369):   at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm( 2369): 
D/AndroidRuntime( 2369): Shutting down VM
W/dalvikvm( 2369): threadid=1: thread exiting with uncaught exception (group=0x40279760)
E/AndroidRuntime( 2369): FATAL EXCEPTION: main
E/AndroidRuntime( 2369): java.lang.OutOfMemoryError
E/AndroidRuntime( 2369): 	at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
E/AndroidRuntime( 2369): 	at java.nio.MemoryBlock.allocate(MemoryBlock.java:92)
E/AndroidRuntime( 2369): 	at java.nio.ReadWriteDirectByteBuffer.<init>(ReadWriteDirectByteBuffer.java:46)
E/AndroidRuntime( 2369): 	at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:67)
E/AndroidRuntime( 2369): 	at org.mozilla.gecko.gfx.PlaceholderLayerClient.<init>(PlaceholderLayerClient.java:71)
E/AndroidRuntime( 2369): 	at org.mozilla.gecko.gfx.PlaceholderLayerClient.createInstance(PlaceholderLayerClient.java:83)
E/AndroidRuntime( 2369): 	at org.mozilla.gecko.GeckoApp.onCreate(GeckoApp.java:1050)
E/AndroidRuntime( 2369): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
E/AndroidRuntime( 2369): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1715)
E/AndroidRuntime( 2369): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1767)
E/AndroidRuntime( 2369): 	at android.app.ActivityThread.access$1500(ActivityThread.java:122)
E/AndroidRuntime( 2369): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1005)
E/AndroidRuntime( 2369): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2369): 	at android.os.Looper.loop(Looper.java:132)
E/AndroidRuntime( 2369): 	at android.app.ActivityThread.main(ActivityThread.java:4028)
E/AndroidRuntime( 2369): 	at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2369): 	at java.lang.reflect.Method.invoke(Method.java:491)
E/AndroidRuntime( 2369): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
E/AndroidRuntime( 2369): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
E/AndroidRuntime( 2369): 	at dalvik.system.NativeStart.main(Native Method)
Priority: -- → P1
Android is probably scaling the 1024x2048 image to 2048x4096. That would result in the 33MB allocation we see here.
Keywords: crash
Whiteboard: [native-crash]
I'm also seeing this too on a Galaxy Tab. Is there any information I can provide to help ? Or a way to remove the screenshot so that the app can launch ?
Looks like we need to write our own ByteBuffer.allocateDirect(). Quoting from the Google bug: "you could allocate memory yourself on the native heap and use NewDirectByteBuffer from JNI."
I encounter this error (and crash) with the about:Firefox page.
Whiteboard: [native-crash] → [native-crash:P1]
(Nightly won't start on my eeeTransformer due to this; it's been that way now for about 5 days.)

Gerv
Workaround - if you have a rooted device you can delete /data/data/org.mozilla.fennec/cache/lastScreen.png (either with a file explorer app or 'adb shell' from the Android sdk).
nthomas: Thanks - I rooted my Transformer (there are easy instructions for Linux on XDA) and once I'd finally tracked down this file, it made it work again. Of course, the problem recurs on a regular basis, so you have to keep doing it :-(

Gerv
We landed code yesterday to _stop_ using the last screenshot. You should not see this problem until we turn it back on, which we won't do until we add code to work around the internal Android bug.
(In reply to Nick Thomas [:nthomas] from comment #11)
> Workaround - if you have a rooted device you can delete
> /data/data/org.mozilla.fennec/cache/lastScreen.png (either with a file
> explorer app or 'adb shell' from the Android sdk).

or you can click the "clear cache" button in the system settings -> applications -> fennec page
Severity: normal → critical
Assignee: pwalton → doug.turner
this has been fixed a while ago.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
tracking-fennec: --- → 11+
Resolution: FIXED → DUPLICATE
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: