Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stack corruption detected, dalvik VM crash

Tags:

android

dalvik

I have a tracker application running on android tablet. I notice that somehow some of the tablets reboots themselves from time to time.

When i investigate the issue find out that i get "stack corruption detected" error then few miliseconds later android VM crashes.

These crashes occur every 5 minutes to 20 minutes there is no pattern other then tracker app running and using GPS and 3G.

These tablets run android 4.2.2 and this is their latest update from Samsung sadly.

There is no mention of my apk in the logs, and my application is pure java. What exactly is causing the issue and how can i fix it?

Below is the logcat output:

05-11 15:33:16.084: A/<unknown>(30963): stack corruption detected: aborted
05-11 15:33:16.116: I/ServiceManager(99): service 'bluetooth_manager' died
05-11 15:33:16.155: I/ServiceManager(99): service 'bluetooth_secure_mode_manager' died
05-11 15:33:16.155: I/ServiceManager(99): service 'input_method' died
05-11 15:33:16.155: I/ServiceManager(99): service 'accessibility' died
05-11 15:33:16.155: I/ServiceManager(99): service 'meminfo' died
05-11 15:33:16.155: I/ServiceManager(99): service 'DirEncryptService' died
05-11 15:33:16.155: I/ServiceManager(99): service 'container_service' died
05-11 15:33:16.155: I/ServiceManager(99): service 'audio' died
05-11 15:33:16.155: I/ServiceManager(99): service 'wallpaper' died
05-11 15:33:16.155: I/ServiceManager(99): service 'display' died
05-11 15:33:16.155: I/ServiceManager(99): service 'power' died
05-11 15:33:16.155: I/ServiceManager(99): service 'activity' died
05-11 15:33:16.155: I/ServiceManager(99): service 'CustomFrequencyManagerService' died
05-11 15:33:16.155: I/ServiceManager(99): service 'gfxinfo' died
05-11 15:33:16.155: I/ServiceManager(99): service 'usagestats' died
05-11 15:33:16.155: I/ServiceManager(99): service 'content' died
05-11 15:33:16.155: I/ServiceManager(99): service 'log_manager_service' died
05-11 15:33:16.155: I/ServiceManager(99): service 'cpuinfo' died
05-11 15:33:16.155: I/ServiceManager(99): service 'account' died
05-11 15:33:16.155: I/ServiceManager(99): service 'telephony.registry' died
05-11 15:33:16.155: I/ServiceManager(99): service 'battery' died
05-11 15:33:16.155: I/ServiceManager(99): service 'entropy' died
05-11 15:33:16.155: I/ServiceManager(99): service 'mount' died
05-11 15:33:16.155: I/ServiceManager(99): service 'sensorservice' died
05-11 15:33:16.155: I/ServiceManager(99): service 'dbinfo' died
05-11 15:33:16.155: I/ServiceManager(99): service 'vibrator' died
05-11 15:33:16.155: I/ServiceManager(99): service 'mdm.remotedesktop' died
05-11 15:33:16.155: I/ServiceManager(99): service 'alarm' died
05-11 15:33:16.155: I/ServiceManager(99): service 'scheduling_policy' died
05-11 15:33:16.155: I/ServiceManager(99): service 'hardware' died
05-11 15:33:16.155: I/ServiceManager(99): service 'user' died
05-11 15:33:16.155: I/ServiceManager(99): service 'permission' died
05-11 15:33:16.155: I/ServiceManager(99): service 'batteryinfo' died
05-11 15:33:16.155: I/ServiceManager(99): service 'edmnativehelper' died
05-11 15:33:16.155: I/ServiceManager(99): service 'harmony_eas_service' died
05-11 15:33:16.155: I/ServiceManager(99): service 'enterprise_policy' died
05-11 15:33:16.155: I/ServiceManager(99): service 'remoteinjection' died
05-11 15:33:16.155: I/ServiceManager(99): service 'clipboard' died
05-11 15:33:16.155: I/ServiceManager(99): service 'clipboardEx' died
05-11 15:33:16.155: I/ServiceManager(99): service 'netstats' died
05-11 15:33:16.155: I/ServiceManager(99): service 'textservices' died
05-11 15:33:16.155: I/ServiceManager(99): service 'statusbar' died
05-11 15:33:16.155: I/ServiceManager(99): service 'application_policy' died
05-11 15:33:16.155: I/ServiceManager(99): service 'wifi_policy' died
05-11 15:33:16.155: I/ServiceManager(99): service 'package' died
05-11 15:33:16.155: I/ServiceManager(99): service 'phone_restriction_policy' died
05-11 15:33:16.155: I/ServiceManager(99): service 'network_management' died
05-11 15:33:16.155: I/ServiceManager(99): service 'enterprise_license_policy' died
05-11 15:33:16.155: I/ServiceManager(99): service 'window' died
05-11 15:33:16.155: I/ServiceManager(99): service 'input' died
05-11 15:33:16.155: I/ServiceManager(99): service 'netpolicy' died
05-11 15:33:16.155: I/ServiceManager(99): service 'multiwindow' died
05-11 15:33:16.155: I/ServiceManager(99): service 'wifip2p' died
05-11 15:33:16.155: I/ServiceManager(99): service 'sec_analytics' died
05-11 15:33:16.155: I/ServiceManager(99): service 'wifi' died
05-11 15:33:16.155: I/ServiceManager(99): service 'wfd' died
05-11 15:33:16.155: I/ServiceManager(99): service 'notification' died
05-11 15:33:16.155: I/ServiceManager(99): service 'dropbox' died
05-11 15:33:16.155: I/ServiceManager(99): service 'devicestoragemonitor' died
05-11 15:33:16.155: I/ServiceManager(99): service 'search' died
05-11 15:33:16.155: I/ServiceManager(99): service 'country_detector' died
05-11 15:33:16.155: I/ServiceManager(99): service 'location' died
05-11 15:33:16.155: I/ServiceManager(99): service 'updatelock' died
05-11 15:33:16.155: I/ServiceManager(99): service 'throttle' died
05-11 15:33:16.155: I/ServiceManager(99): service 'servicediscovery' died
05-11 15:33:16.155: I/ServiceManager(99): service 'connectivity' died
05-11 15:33:16.155: I/ServiceManager(99): service 'lock_settings' died
05-11 15:33:16.155: I/ServiceManager(99): service 'device_policy' died
05-11 15:33:16.155: I/ServiceManager(99): service 'usb' died
05-11 15:33:16.155: I/ServiceManager(99): service 'serial' died
05-11 15:33:16.155: I/ServiceManager(99): service 'uimode' died
05-11 15:33:16.155: I/ServiceManager(99): service 'backup' died
05-11 15:33:16.155: I/ServiceManager(99): service 'appwidget' died
05-11 15:33:16.155: I/ServiceManager(99): service 'diskstats' died
05-11 15:33:16.155: I/ServiceManager(99): service 'AtCmdFwd' died
05-11 15:33:16.155: I/ServiceManager(99): service 'samplingprofiler' died
05-11 15:33:16.155: I/ServiceManager(99): service 'commontime_management' died
05-11 15:33:16.155: I/ServiceManager(99): service 'motion_recognition' died
05-11 15:33:16.155: I/ServiceManager(99): service 'voip' died
05-11 15:33:16.155: I/ServiceManager(99): service 'dreams' died
05-11 15:33:16.155: I/ServiceManager(99): service 'license_log_service' died
05-11 15:33:16.162: W/AudioFlinger(30688): power manager service died !!!
05-11 15:33:16.170: I/audio_policy_mrvl(30688): mrvl_ap_dev_release_output: 2 (hardware output)
05-11 15:33:16.170: I/audio_policy_mrvl(30688): mrvl_ap_dev_release_output: 2 (hardware output)
05-11 15:33:16.178: W/Sensors(31110): sensorservice died [0x5d194240]
05-11 15:33:16.178: W/Sensors(31315): sensorservice died [0x5d1b4d70]
05-11 15:33:16.178: W/Sensors(31217): sensorservice died [0x5bab4fa0]
05-11 15:33:16.178: W/Sensors(31204): sensorservice died [0x5d1ae190]
05-11 15:33:16.178: W/Sensors(2742): sensorservice died [0x5d13c0e8]
05-11 15:33:16.186: D/SurfaceFlinger(111): Screen acquired, type=0 flinger=0x405083c8
05-11 15:33:16.186: D/SurfaceFlinger(111):  screen was previously acquired
05-11 15:33:16.373: D/AndroidRuntime(31204): Shutting down VM
05-11 15:33:16.373: W/dalvikvm(31204): threadid=1: thread exiting with uncaught exception (group=0x40dee930)
05-11 15:33:16.420: E/AndroidRuntime(31204): FATAL EXCEPTION: main
05-11 15:33:16.420: E/AndroidRuntime(31204): java.lang.RuntimeException: android.os.DeadObjectException
05-11 15:33:16.420: E/AndroidRuntime(31204):    at android.net.TrafficStats.getMobileIfaces(TrafficStats.java:641)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at android.net.TrafficStats.getMobileTxPackets(TrafficStats.java:270)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at com.android.internal.telephony.DataConnectionTracker$TxRxSum.updateTxRxSum(DataConnectionTracker.java:510)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at com.android.internal.telephony.DataConnectionTracker.updateDataActivity(DataConnectionTracker.java:1566)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at com.android.internal.telephony.DataConnectionTracker$2.run(DataConnectionTracker.java:431)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at android.os.Handler.handleCallback(Handler.java:725)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at android.os.Handler.dispatchMessage(Handler.java:92)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at android.os.Looper.loop(Looper.java:176)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at android.app.ActivityThread.main(ActivityThread.java:5365)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at java.lang.reflect.Method.invokeNative(Native Method)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at java.lang.reflect.Method.invoke(Method.java:511)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at dalvik.system.NativeStart.main(Native Method)
05-11 15:33:16.420: E/AndroidRuntime(31204): Caused by: android.os.DeadObjectException
05-11 15:33:16.420: E/AndroidRuntime(31204):    at android.os.BinderProxy.transact(Native Method)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at android.net.INetworkStatsService$Stub$Proxy.getMobileIfaces(INetworkStatsService.java:232)
05-11 15:33:16.420: E/AndroidRuntime(31204):    at android.net.TrafficStats.getMobileIfaces(TrafficStats.java:639)
05-11 15:33:16.420: E/AndroidRuntime(31204):    ... 13 more
05-11 15:33:16.452: E/installd(116): eof
05-11 15:33:16.452: E/installd(116): failed to read size
05-11 15:33:16.452: I/installd(116): closing connection
05-11 15:33:16.452: I/Process(31204): Sending signal. PID: 31204 SIG: 9
05-11 15:33:16.452: E/AndroidRuntime(31204): Error reporting crash
05-11 15:33:16.452: E/AndroidRuntime(31204): android.os.DeadObjectException
05-11 15:33:16.452: E/AndroidRuntime(31204):    at android.os.BinderProxy.transact(Native Method)
05-11 15:33:16.452: E/AndroidRuntime(31204):    at android.app.ActivityManagerProxy.handleApplicationCrash(ActivityManagerNative.java:3624)
05-11 15:33:16.452: E/AndroidRuntime(31204):    at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:138)
05-11 15:33:16.452: E/AndroidRuntime(31204):    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
05-11 15:33:16.452: E/AndroidRuntime(31204):    at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
05-11 15:33:16.452: E/AndroidRuntime(31204):    at dalvik.system.NativeStart.main(Native Method)
05-11 15:33:16.467: I/ServiceManager(99): service 'phone' died
05-11 15:33:16.467: I/ServiceManager(99): service 'isms' died
05-11 15:33:16.467: I/ServiceManager(99): service 'phoneext' died
05-11 15:33:16.467: I/ServiceManager(99): service 'iphonesubinfo' died
05-11 15:33:16.467: I/ServiceManager(99): service 'sip' died
05-11 15:33:16.467: I/ServiceManager(99): service 'simphonebook' died
05-11 15:33:16.467: I/audio_policy_mrvl(30688): mrvl_ap_dev_release_output: 2 (hardware output)
05-11 15:33:16.608: I/BootAnimation(6191): ret=2, fps:12, interval:83333
05-11 15:33:16.639: I/BootAnimation(6191): createSurface RGB565
05-11 15:33:16.639: E/BootAnimation(6191): /sys/class/sec/led/led_pattern: open error, fd = -1
05-11 15:33:16.639: W/BootAnimation(6191): resolution w=600, h=1024
05-11 15:33:16.639: W/BootAnimation(6191): original qmg w=600, h=1024
05-11 15:33:17.233: E/InputEventReceiver(31217): channel ~ Publisher closed input channel or an error occurred.  events=0x9
05-11 15:33:17.444: E/InputEventReceiver(31110): channel ~ Publisher closed input channel or an error occurred.  events=0x9
05-11 15:33:17.444: E/Sensors(31315): SensorEventQueue::waitForEvent error HANGUP
05-11 15:33:17.444: E/InputEventReceiver(835): channel ~ Publisher closed input channel or an error occurred.  events=0x9
05-11 15:33:17.452: E/InputEventReceiver(31110): channel ~ Publisher closed input channel or an error occurred.  events=0x9
05-11 15:33:17.452: E/InputEventReceiver(835): channel ~ Publisher closed input channel or an error occurred.  events=0x9
05-11 15:33:17.452: E/InputEventReceiver(835): channel ~ Publisher closed input channel or an error occurred.  events=0x9
05-11 15:33:17.452: E/InputEventReceiver(835): channel ~ Publisher closed input channel or an error occurred.  events=0x9
05-11 15:33:17.452: D/Zygote(30691): Process 30963 terminated by signal (6)
05-11 15:33:17.452: I/Zygote(30691): Exit zygote because system server (30963) has terminated
05-11 15:33:17.616: I/Netd(6197): Netd 1.0 starting
05-11 15:33:17.623: W/InterfaceController(6197): Warning (Cannot load library: load_library(linker.cpp:745): library "/system/lib/libnetcmdiface.so" not found) while opening the net interface command library
05-11 15:33:17.772: E/SMD(107): DCD OFF
05-11 15:33:17.928: I/ServiceManager(99): service 'media.audio_flinger' died
05-11 15:33:17.928: I/ServiceManager(99): service 'media.player' died
05-11 15:33:17.928: I/ServiceManager(99): service 'media.camera' died
05-11 15:33:17.928: I/ServiceManager(99): service 'media.audio_policy' died
05-11 15:33:17.936: D/FileMonitorService(120): binderDied() 1 0x40918c90, tid 158, calling tid 120
like image 207
Numenor Avatar asked May 11 '15 13:05

Numenor


2 Answers

That's not your app crashing. That's the Android runtime crashing, and it's taking everything (including your app) with it.

Any time you see a huge pile of services dying, you know that system_server has died. Some specific logs highlight the failure:

05-11 15:33:16.084: A/<unknown>(30963): stack corruption detected: aborted
[...]
05-11 15:33:17.452: D/Zygote(30691): Process 30963 terminated by signal (6)
05-11 15:33:17.452: I/Zygote(30691): Exit zygote because system server (30963) has terminated

The first identifies stack corruption of the native system_server heap as the failure cause, the other two identify pid 30963 as system_server. Signal 6 is SIGABRT, which system_server sent to itself when the corruption was detected.

This is not something you can fix -- there is a bug in the platform, not your app. My guess is that there's a bit of bad code running in system_server, possibly introduced by the OEM, that is being exercised by your app. You may be able to work around the problem by changing your app's behavior to not exercise the bug, but without knowing more about the bug that can be difficult. If there's no update past 4.2.2 for this device then getting a fix for the system from the manufacturer is unlikely.

You might be able to learn a little more by gathering the logs with adb logcat -v threadtime to show the thread IDs, and then see which thread reports the corruption. An adb shell ps -t before the crash might give a meaningful label to the thread. Of course, with native corruption, any thread could stomp on any other thread, but with stack corruption it's more likely that the thread is harming itself.

like image 127
fadden Avatar answered Oct 23 '22 14:10

fadden


This issue is GPS related and it's smooth after few weeks of factory reset then it happens again. So i took a wild guess and thought it has something to do with A-GPS caching.

I use the following code to clear GPS cache after each reboot and it seems to be working.

locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
locationManager.sendExtraCommand(LocationManager.GPS_PROVIDER,"delete_aiding_data", null);
Bundle bundle = new Bundle();
locationManager.sendExtraCommand("gps", "force_xtra_injection", bundle);
locationManager.sendExtraCommand("gps", "force_time_injection", bundle);

This is still not a fix, it's just a workaround to ignore and postpone the problem. The actual problem exist with SM-T111NQ devices and Samsung has yet to provide a fix.

like image 25
Numenor Avatar answered Oct 23 '22 12:10

Numenor