Obsolete
Status Update
Comments
en...@google.com <en...@google.com>
cf...@google.com <cf...@google.com> #2
Malloc debug has been rewritten in the latest aosp release so this doesn't apply any more.
Description
steps to reproduce:
1.enable libc.debug.malloc 1 for all process throght the property seting as below
adb shell "echo libc.debug.malloc=1 >> /data/local.prop"
adb shell "chmod 644 /data/local.prop"
adb reboot
2.after phone reboot run monkey test or free test, sometimes deadlock occur, bactrace maybe as below: child process block on mutex
#00 pc 0000000000019c58 /system/lib64/libc.so (syscall+28)
#01 pc 00000000000201dc /system/lib64/libc.so (pthread_mutex_lock+148)
#02 pc 000000000000316c /system/lib64/libc_malloc_debug_leak.so
#03 pc 00000000000197d4 /system/lib64/libc.so (malloc+20)
expected:
system can run smoothly
Issue root cause:
malloc_debug_leak.cpp leak_malloc/leak_free get g_hash_table->lock in parent process then fork child process, due to mutex in lock state and can't release, so child process can't get the mutex and block forever.
Suggest fix method:
register pthread_atfork callback to sync the g_hash_table->lock.