Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,780,834 Members 51,020 Now Online
XDA Developers Android and Mobile Development Forum

[Q] Low on RAM due to lots of app_process instances.

Tip us?
 
a1291762
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 10
Join Date: Nov 2012
Default [Q] Low on RAM due to lots of app_process instances.

I have a RAZR i with the standard UK 4.1.2 ROM. Sometimes I've had low memory problems or periods where the battery runs down unexpectedly. I recently started experiencing severe memory shortage after running with data disabled and poked around a bit. What I discovered was a large number of app_process instances taking 8M each.

From what I can tell, I should not see these. Android runs this process but it loads Java code into itself and changes personality. So while there's plenty of app_process instances running, they don't show up as such when you do a ps.

I found this out the hard way running killall app_process :/

But I can use this to kill off any of these "zombie" app_process instances: ps | grep app_process | busybox awk '{print $2}' | xargs kill

Running with data disabled seems to make these happen fairly reliably. Made me suspect something was being spawned to look for something on the network but failed due to a lack of data and then... got stuck instead of exiting?

I've disabled a few things on this ROM before. I think ModemStats or similar was a problem once before (chewing up CPU).

Has anyone seen this?

Is there something I can capture that would help diagnose the cause (I've heard of a logcat? maybe ps output?).
 
5m00v3
Old
#2  
Member
Thanks Meter 29
Posts: 81
Join Date: Nov 2013
Location: Hamburg
Quote:
Originally Posted by a1291762 View Post
...Is there something I can capture that would help diagnose the cause (I've heard of a logcat? maybe ps output?).
sure, setup ADB and plug your device with a micro-usb cable on pc. Now you can logcat and also grep your favorit process.
Did you try limiting your backgroundprocesses under Developer-Options > backgroundprocess-limit ?
I use all the time a limit of 4 processes and have no memory problems (fyi: it will fall back to standard-setting after reboot)
Phones: HTC Explorer (Pico) - CyanogenMod / Razr i - Root with locked BL Daily / Huawei G510-0100 - as developer device
[HARDWARE MOD] Microphone Cover - RAZRi - - - - - [APP] Playstation Mobile - ROOT needed
 
Marco Lomas
Old
#3  
Marco Lomas's Avatar
Senior Member
Thanks Meter 170
Posts: 610
Join Date: Feb 2012
Use the app Greenify to hibernate the apps you dont use daily

Enviado desde mi XT890 mediante Tapatalk
 
a1291762
Old
#4  
Junior Member - OP
Thanks Meter 0
Posts: 10
Join Date: Nov 2012
So... Greenify and limiting background "apps" can't help here because app_process isn't an app, it's a system process.

And it seems logcat isn't very useful when run after-the-fact? Oh it seems you can't run it except as root from Android 4.1 onwards. I've now got catlog recording so maybe next time I'll get something useful - assuming my SD card doesn't fill up first.

And of course now that I'm trying to _look_ at the problem, it's happening less frequently >:|
 
Marco Lomas
Old
#5  
Marco Lomas's Avatar
Senior Member
Thanks Meter 170
Posts: 610
Join Date: Feb 2012
Amm app process are services, with the greenify app kills the services.....
If you havent root, well, remove the task on recent app list, force detention of the apps manually, and so on

Enviado desde mi XT890 mediante Tapatalk
 
a1291762
Old
#6  
Junior Member - OP
Thanks Meter 0
Posts: 10
Join Date: Nov 2012
Please don't spread misinformation. app_process is a system process. It is not even visible at the Android layer. Every app starts as an app_process instance. Greenify cannot even see it, let alone control it.
 
a1291762
Old
#7  
Junior Member - OP
Thanks Meter 0
Posts: 10
Join Date: Nov 2012
The good news is I have a logcat. The bad news is it's a 37Mb file and both the system ui and logcat app died due to lack of memory. I have second logcat fr when I noticed but the end of the first one if probably more useful. Having trouble reading the file on my phone. Will investigate more when I get home tonight.
 
a1291762
Old
#8  
Junior Member - OP
Thanks Meter 0
Posts: 10
Join Date: Nov 2012
Default bug2go is evil???

So app_process is AndroidRuntime. I see various AndroidRuntime START messages. Looks like normal starting of apps. Until 16:24 on 03-22.

Code:
03-22 03:30:04.822 D/AndroidRuntime(29699): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 08:35:03.670 D/AndroidRuntime(31593): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 08:35:03.670 D/AndroidRuntime(31592): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 08:38:03.542 D/AndroidRuntime(31650): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 08:38:03.552 D/AndroidRuntime(31651): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 09:23:10.850 D/AndroidRuntime( 1024): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 09:23:10.850 D/AndroidRuntime( 1025): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 09:41:29.170 D/AndroidRuntime( 2245): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 15:27:38.730 D/AndroidRuntime( 4879): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 15:41:39.630 D/AndroidRuntime( 5729): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 15:41:39.630 D/AndroidRuntime( 5730): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:30.350 D/AndroidRuntime( 6042): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:35.710 D/AndroidRuntime( 6064): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:35.910 D/AndroidRuntime( 6074): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:36.050 D/AndroidRuntime( 6079): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:36.320 D/AndroidRuntime( 6098): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:36.340 D/AndroidRuntime( 6087): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:36.400 D/AndroidRuntime( 6102): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:36.620 D/AndroidRuntime( 6105): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:36.690 D/AndroidRuntime( 6111): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:36.860 D/AndroidRuntime( 6133): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:36.950 D/AndroidRuntime( 6136): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
...
03-22 16:24:48.350 D/AndroidRuntime( 6650): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:48.350 D/AndroidRuntime( 6654): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:48.530 D/AndroidRuntime( 6744): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
03-22 16:24:48.610 D/AndroidRuntime( 6670): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
Something is running com.android.am.Am over and over again.

Code:
2014-03-20-08-45-47.txt|417176| 03-22 16:24:38.060 D/AndroidRuntime( 6111): Calling main entry com.android.commands.am.Am
2014-03-20-08-45-47.txt|417215| 03-22 16:24:38.380 D/AndroidRuntime( 6133): Calling main entry com.android.commands.am.Am
2014-03-20-08-45-47.txt|417216| 03-22 16:24:38.410 D/AndroidRuntime( 6136): Calling main entry com.android.commands.am.Am
2014-03-20-08-45-47.txt|417225| 03-22 16:24:38.620 D/AndroidRuntime( 6140): Calling main entry com.android.commands.am.Am
Am seems to be an android tool to run shell commands. What's being run?

Code:
03-22 16:24:48.440 D/su      ( 6756): su invoked.
03-22 16:24:48.440 D/su      ( 6756): Allowing shell.
03-22 16:24:48.440 D/su      ( 6756): 2000 /system/xbin/su executing 0 showmap using binary showmap : showmap 129
03-22 16:24:48.440 E/su      ( 6756): exec failed with 2: No such file or directory
Hm... Running a binary that doesn't exist lots and lots of times? That can't be a coincidence. Looks like app_process doesn't properly clean up in this case.

But what is causing all this in the first place? I found this.

Code:
03-22 16:24:29.600 I/bug2go-bugreport( 6037): bugreport started
03-22 16:24:29.610 I/bug2go-bugreport( 6037): reportId=2014-03-22_16-24-29.000+1000
03-22 16:24:29.610 I/bug2go-bugreport( 6037): Available space in /storage/sdcard0/bug2go is 1227 MB
03-22 16:24:29.610 I/bug2go-bugreport( 6037): Required space is 50
03-22 16:24:29.610 I/bug2go-bugreport( 6037): Storing report to /storage/sdcard0/bug2go/user@2014-03-22_16-24-29.000+1000
...
03-22 16:24:30.690 W/ActivityManager(  384): Unable to start service Intent { act=motorola.intent.action.BUG2GO.BUGREPORT.START typ=text/plain (has extras) }: not found
Now that's odd. The bug2go apk is something I had previously removed. But the 2 bug2go binaries in /system/bin were still there. I can't see what triggered this (unless it's that last line, some kind of period attempt to run the now-missing bug2go app). Scrolling up in the logs I see... nothing but wifi scanning. My phone was suspended at the time so nothing was happening.

I've removed the bug2go binaries from /system/bin. That seems to be the source of the problem so maybe that'll fix things?
 
a1291762
Old
#9  
Junior Member - OP
Thanks Meter 0
Posts: 10
Join Date: Nov 2012
I also got a log after I noticed my phone was bad. It shows the last showmap error.

Code:
03-22 16:25:33.300 D/su      (8732): su invoked.
03-22 16:25:33.300 D/su      (8732): Allowing shell.
03-22 16:25:33.300 D/su      (8732): 2000 /system/xbin/su executing 0 showmap using binary showmap : showmap 28103
03-22 16:25:33.300 E/su      (8732): exec failed with 2: No such file or directory
And then, bug2go either gives up or finishes.

Code:
03-22 16:26:16.850 I/dumpstate(6054): done
03-22 16:26:16.850 I/bug2go-bugreport(6037): Dropping from root user to log user
So that at least explains why the phone doesn't ground to a permanent halt and why I can kill off these processes and have the phone continue to work.

Aha! It's actually dumpstate that causes the bug. It's run by bug2go but also by 'adb bugreport'. It tries to run showmap on... each running process? But since I don't have that binary, it leaves behind all the app_process instances. I ran 'adb bugreport' just now and it caused my phone to reboot!

So removing the bug2go binaries should stop this from being a problem but I'm kind of stumped as to why I have 'dumpstate' but not 'showmap' on my phone...

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes