-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Android Throwing OutOfMemoryError crash #9665
Comments
I get this same crash, closer to only 1 minute after launch (also not doing anything). Seems to only happen when debugging through Chrome. |
Same here with a remote Android 5.0.2 while debugging through Chrome. |
Hi! Same problem here on Android. I've just started a project with react-native init and begun to follow the Facebook tutorial. When I run the app without debugging, it works fine. If I enable Debug JS remotely, it crashes after 1 minute (doing nothing). Testing on Samsung Galaxy S5, Android 5.0, react-native-cli 0.2.0, react-native 0.32.1, Windows 7, Chrome 53. It's a really simple app (I'm starting with RN), with just a couple of text components and an image, and I'm getting exactly the same stacktrace. Since it's an OutOfMemory problem I've tried to add I've modified my app, so it loads a component with an image 5000 times. With the debugging disabled, the app allocates up to 70Mb and works fine. I can scroll all over the screen and nothing crashes. So is not a low memory problem on the device. When I enable the remote debugging, it works for a while, until it tries to allocate more memory and crashes again (around 1-2 minutes). If I launch the app with the debugging already enabled, it starts well (and goes up to the 70Mb fine), but again crashes after a while. The debugging is constantly consuming memory until it eventually crashes when (I think) it needs to allocate a new chunk of memory. |
This is a bug with remote-debugging. For some reason it constantly tries to open a connection to port 8087 and runs out of memory with the sockets. |
I'm running in either the same or similar issue. Everything seems to be fine with my app when I don't have remote js debugging on. When I turn it on the app crashes. In my case I can't say when exactly the app crashes. Sometimes it could be 30s. other times 2 mins. Here is the output from adb logcat
|
Please analyze your memory, here's a guide on how to do that: https://developer.android.com/studio/profile/am-memory.html |
@fab1an - the crazy thing is that since I launched the memory monitor in android studio yesterday evening the app hasn't crashed once... 9h without a crash... Event after closing Android Studio the app still works without any issues. No clue what happened here. Before that it was crashing like every minute... |
@compojoom Can you still try to look at the Heap with hprof and check it out? I know it takes some getting used to, but it's a vital skill for Android/Java and you might learn what's going on. Is there an unusual number of Activities, Applications, Images or else not being collected. How long is the finalizer queue and so on. |
@fab1an - well I can generate a heap and look at it. But the thing is - if the app isn't crashing anymore how is the heap going to help us? |
@compojoom Maybe you find a memory-leak that causes the crash when it get's too large. If you have an OutOfMemoryError in a Java app the first thing you should do is doing a heap-dump to check where all the memory has gone to. |
@compojoom Check out: #8677 (comment) |
@fab1an - can you explain something to me. I thought that the heap-dump would work more like the xdebug profiler. You have it running all the time and when you hit the error you have the situation recorded. The heap-dump seems to be a snapshot of the memory for a second. How is this going to help with debugging the issue if the app crashes 10 mins after the heap-dump was taken? I thought that maybe if I run the memory allocation I'll know more, but when the app crashes the memory monitor stops and the record allocation doesn't complete. How am I supposed to take a heap-dump that would actually help with debugging this? |
@compojoom You could check out the heap-dump for unusual memory usage. If you have 3 activities, 10 views and 200 Bitmaps in the dump, while you app actually has 1 Activity, 5 views and 10 bitmaps, then you know there's something going wrong. |
Here is the heap-dump if you are interested. Around 10s later the app crashed. For me this is currently Chinese. I'll have to read a lot in order to understand it. I've run the analizer tasks and it doesn't find any leaked activities, but some duplicated strings ( no idea what that is). The interseting part is that when I click on the STring (jhava.lang) class name I see a lot of instances that have "http://localhost:8097" Why 8097? The debugger should be running on 8081, no? |
Sorry, I don't have time to do that work for you. |
no problem @fab1an - I didn't mean it to sound that way. I'll try to figure that out. As far port 8097 is concerned. It seems that it is related to react devtools. I'll write my findings here. |
I still can't figure out why the app crashes (can't find anything out of the ordinary in the heap), but I found the following. When I restart the device - no app crashes. |
Any news on this? |
Btw, we encounter this issue since RN 0.34 and above. With an app that is still based on RN 0.26 the issue never happens while debugging with chrome, but apps with RN 0.34 and RN 0.38 have this issue as the others describe above |
Having this issue too.
RN: 0.35.0 On device with remote debug Chrome Devtools open. |
Also having this issue. I've been debugging it all day but haven't found a way around it. Appears to be a combination between live reload, debugger and WebView. |
+1. Happens after around 1 minute with the app open on a real device and debugging on chrome. RN 0.40. |
getting this as well, just enough leaving the app opened for a couple of minutes, using RN 0.43.0-rc.3
pretty constant and reproduceable |
Keeping the memory monitor open in android studio solves the problem for me as well, as observered by @compojoom. I'm using RN 0.41 |
For me it only crashes when I am using remote debugging. ( 0.42.3 ) |
I have this since I upgraded to the current release 0.42.x .... I was on version 0.40 before and it did not happen there. |
Same here : Adding |
This issue seems to come and go. Can't really find what is that magic star alignment that is causing it. I had that issue in 0.42 a couple of times and then it kind of fixed it itself. Now I have it again with 0.45.1. @projoneftw your solution doesn't work for me unfortunately |
In our company we develop numbers of APPs at the same time. We found that if a phone has installed many DEBUG version of APPs of ours, then it is likely to cause OOM. I guess that there are memory leaks in okhttp(especially when fetching bundle) that fill the heap and then cause OOM. |
Just set up a new react native android project, the moment I turn on remote debugging and then do R R - the app crashes. Followed react native android guide, I'm on Macbook Pro Sierra, Android Studio 2.3.3, |
For those stuck, as a workaround you could launch another emulator on iOS: react-native run-ios --simulator="iPhone 5" |
same error here, with version Precondition: opening 'debug js remotely' on real device and enable 'live&hot reloading', wait for about 1min, app exit.
|
I'm getting this issue with 0.48.2. App closes immediately when debug mode is enable. I didn't have such problem before the update from 0.46 |
My app runs fine with the debugger off and crashes consistently, always at different times, in the first few seconds after launching it, when remote debugging is turned on. Seems odd that there is no response from the RN team with this issue being so prevalent. |
Also getting this issue with Genymotion Emulator. I've tried various Android versions. As above, only when remote debugging. |
Same problem here with RN 0.45.1 using Genymotion and debugger on:
|
Did you find what causes problem? |
Hi, i'm having the same on Android with latest react-native 0.50.3 and React 16.0.0 11-28 02:45:37.507 3466-3481/com.mstore I/art: Clamp target GC heap from 104MB to 96MB |
I achieve a similar OOM situation to @minhcasi from react-native-fcm/Firebase after force-closing then restarting the Android app. Perhaps related? evollu/react-native-fcm#621 |
@coreform Yes, I think they are related. I have payed weeks for the OOM issue. |
In my case the app runs just fine with the debugger turned off. The same as @rolgalan comment |
Same here. My app might work for a while after turning on the remote debugger, however any livereload (because I changed and saved some file) has a big chance to break it. "Unfortunately the APP has stopped." After trying to run the application again on emulator it fails again, until I try like 3-4 times.
|
i get this error E/MPlugin: Unsupported class: com.mediatek.common.telephony.IOnlyOwnerSimSupport |
Anybody deal with this problem? |
It's a workaround, but I found that the problem went away if I switched to the standalone RN Debugger instead of Chrome: https://github.com/jhen0409/react-native-debugger. Plus it has a few other advantages, like being able to use the network tab. |
This feature has become a magnet for any Android OutOfMemory error. I'll close it in favor of opening new issues that track specific, reproducible OOMs. |
Issue Description
My app crash every 5 minutes on my android remote device, even if I'm not doing anything on it (live reload or whatever)
Additional Information
Adding
to the Manifest.xml doesn't help
The text was updated successfully, but these errors were encountered: