Android BUG (4)-card death of Android apps

Source: Internet
Author: User

Running some apks causes the application to become stuck.

For android, it is inevitable to run some sub-programs. common sub-programs include quadrant (quadrant), Nant, and antu. As a system engineer, they are very disdainful about these sub-programs. This can only be an objective reference, but customers like this comparison, various factories will do more or less Optimization on this (or even cheating or direct fraud). This is not a good phenomenon. It is very exaggerated. Satellites are everywhere, producing of the RMB. The common program used in China is antu, but I don't know if you have found that after antu runs, it sometimes gets stuck, except for the Return key and touch operation.

When this problem occurs, the home Key can exit and continue to run other applications, indicating that the system is still normal. Top, vmstat. There are no processes with high CPU/IO usage. ps-t: No threads in D state are found. However, <span style = "ps-t found a phenomenon:

App_47 9691 8787 610076 28768 ffffffff 2aac4424 S com. antutu. ABenchMark
App_47 9706 9691 609060 24476 80061b00 2aac5434 S com. antutu. ABenchMark
A process with the same name is displayed! This is strange ~
View the parent processes of these two processes. One is zygote and the other is com. antutu. ABenchMark. From this we can infer that the last process is from the previous process fork, and it gets stuck before the fork can get exec.

Connect to adb and check the status of the two processes:

Process: 9691
(Gdb) bt
#0 read () at bionic/libc/arch-mips/syscall/ read. S: 13
#1 runtime in executeProcess (env = 0x1c7e60, javaCommands = 0x2c118ab8, javaEnvironment = 0x0, javaWorkingDirectory = 0x0, inDescriptor = 0x2c118af0, outDescriptor = role,
ErrDescriptor = 0x2c118b10, redirectErrorStream = 0 '\ 000') at libcore/luni/src/main/native/java_lang_ProcessManager.cpp: 165
#2 ProcessManager_exec (env = 0x1c7e60, javaCommands = 0x2c118ab8, javaEnvironment = 0x0, javaWorkingDirectory = 0x0, inDescriptor = 0x2c118af0, outDescriptor = Snapshot,
ErrDescriptor = 0x2c118b10, redirectErrorStream = 0 '\ 000') at libcore/luni/src/main/native/java_lang_ProcessManager.cpp: 240
#3 0x2b8cccc4 in call_it () at external/libffi/src/mips/o32.S: 145
#4 0x0026eb78 in ?? ()
Nothing special. It is indeed stuck in the fork of process.

Let's take a look at process 9706.

(Gdb) info thread
* 1 Thread 9706 _ futex_syscall4 () at bionic/libc/arch-mips/bionic/atomics_mips.S: 218
(Gdb) bt
#0 _ futex_syscall4 () at bionic/libc/arch-mips/bionic/atomics_mips.S: 218
#1 0x2aabc288 in _ normal_lock (mutex = 0x2ab2142c) at bionic/libc/bionic/pthread. c: 951
#2 pthread_mutex_lock (mutex = 0x2ab2142c) at bionic/libc/bionic/pthread. c: 1041
#3 0x2aabf848 in dlmalloc (bytes = 4096) at bionic/libc/bionic/dlmalloc. c: 4261
#4 0x2aace004 in _ smakebuf (fp = 0x2ab21598) at bionic/libc/stdio/makebuf. c: 62
#5 0x2aad4658 in _ swsetup (fp = 0x2ab21598) at bionic/libc/stdio/wsetup. c: 73
#6 0x2aace6a0 in putc_unlocked (c = 48, fp = <value optimized out>) at bionic/libc/stdio/putc. c: 46
#7 0x2aace744 in putc (c = 48, fp = 0x2ab21598) at bionic/libc/stdio/putc. c: 64
#8 0x2aae44c0 in cpuacct_add (uid = <value optimized out>) at bionic/libc/bionic/cpuacct. c: 55
#9 0x2aae57b0 in fork () at bionic/libc/bionic/fork. c: 57
#10 bytes in executeProcess (env = 0x1c7e60, javaCommands = 0x2c118ab8, javaEnvironment = 0x0, javaWorkingDirectory = 0x0, inDescriptor = 0x2c118af0, outDescriptor = snapshot,
ErrDescriptor = 0x2c118b10, redirectErrorStream = 0' \ 000 ') at libcore/luni/src/main/native/java_lang_ProcessManager.cpp: 92
#11 ProcessManager_exec (env = 0x1c7e60, javaCommands = 0x2c118ab8, javaEnvironment = 0x0, javaWorkingDirectory = 0x0, inDescriptor = 0x2c118af0, outDescriptor = listener,
ErrDescriptor = 0x2c118b10, redirectErrorStream = 0 '\ 000') at libcore/luni/src/main/native/java_lang_ProcessManager.cpp: 240
#12 0x2b8cccc4 in call_it () at external/libffi/src/mips/o32.S: 145
#13 0x0026eb78 in ?? ()
(Gdb)
We can see that it is stopped in bionic's fork. The specific function is: fprintf in cpuacct_add (getuid. The cause of the error is determined by bt, and it is also a lock problem.

After finding the cause of the problem, I did not spend any effort to solve the problem. I simply Googled the problem and solution:

Https://code.google.com/p/android/issues/detail? Id = 19916
Comment 1 by gabrb...@gmail.com, Nov 23,201 1
This issue has also been found on ICS. cpuacct_add shocould not be doing anything that callmalloc () or free (). Proposed fixes are here:
Http://review.omapzoom.org/16579
Http://review.omapzoom.org/16573

Now more and more apk will secretly fork processes, execute the command in the system or dump debugging information, or even like skype, it will look like fork is a lot of native services written by itself.
Author: freshui

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.