Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android device reboots occasionally

We are testing our Android app on real-world devices and notice some of them reboot occasionally after 2-3 hours of app running. The app consists of one service with 3 threads (with GPS and network) and two activities, one of wich is resource-consuming (displays the map)

Logcat did not help, as we did not see any important messages before the device reboots. Sometimes the device even does not start, only battery removal helps to start it again.

The devices are based on different hardware, produced in different countries (mostly PRC, hehe) and use different Android versions.

What are the most common problems that could lead to device reboot and how does one debug it?

like image 734
saabeilin Avatar asked Jun 29 '12 20:06

saabeilin


People also ask

Why does my phone reboots randomly?

If your device keeps randomly restarting, in some cases may mean that poor quality apps on the phone are the issue. Uninstalling third-party apps can potentially be the solution. You may have an app running in the background that is causing your phone to restart.


2 Answers

There're two kinds of reboot in Android:

  1. System server fault. In that case no reboot happens but Zygote restarts instead. Common reasons:

    • Watchdog killed a system_server process because of deadlock in of services it's running.
    • Fatal exception occured in one of system services. However, the actual reason sometimes may be a hardware issue. For example, in some cases after factory reset ext2 partitions aren't formatted as follows. It leads to errors and /data/ partition is mounted as read-only, which produces a bunch of errors.
    • In rare cases watchdog can be timed out because of high memory and CPU usage.

    Both are quite rare and can be reproduced mostly in monkey-testing, not real-case scenarios. You may see an example of logcat output by killing the service_manager process with adb shell.

  2. Kernel panic. In that case device actually reboots. As kernel panic happens on the layer beyound Android, it won't produce any logcat output. Instead it'll write a stack trace into console. You may read it from /dev/kmsg or from ADB shell: adb shell dmesg.

    Unfortunately it's hard to read those as on most devices console output is disabled and kmsg buffer will be erased on each reboot.

P.S. Also reboot may be caused by hardware issues. In that case it's unlikely to find any traces but hopefully this should be reproduced only on particular devices.

like image 160
Andrey Ermakov Avatar answered Oct 05 '22 16:10

Andrey Ermakov


I had a similar problem (also gps and network) I have forgoten to set the network update timer to production (15 minutes) so the device updated every 15 seconds any way the device overheated soner or later (htc desire)
Try to minimize the cpu usage ( profiling) or ensure a proper cooling mechanism

like image 41
sherif Avatar answered Oct 05 '22 15:10

sherif