#1997 Android BluetoothDevice.getName() causes ANRs

Open
opened 1 month ago by TaaviE · 0 comments
TaaviE commented 1 month ago
name about
Bug report Android BluetoothDevice getName causes ANRs

Your issue is:

"main" prio=5 tid=1 Native
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x7120dd98 self=0x774c284c00
  | sysTid=9825 nice=0 cgrp=default sched=0/0 handle=0x774d7e6ed0
  | state=S schedstat=( 22342171300 1722057213 521104 ) utm=1149 stm=1084 core=0 HZ=100
  | stack=0x7fe91a1000-0x7fe91a3000 stackSize=8192KB
  | held mutexes=
  #00  pc 000000000007f33c  /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28)
  #01  pc 000000000014b094  /apex/com.android.runtime/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+148)
  #02  pc 000000000058f9b4  /apex/com.android.runtime/lib64/libart.so (art::GoToRunnable(art::Thread*) (.llvm.15732748762076278778)+460)
  #03  pc 000000000058f7a4  /apex/com.android.runtime/lib64/libart.so (art::JniMethodEnd(unsigned int, art::Thread*)+28)
  at android.os.BinderProxy.transactNative (BinderProxy.java)
  at android.os.BinderProxy.transact (BinderProxy.java:511)
  at android.bluetooth.IBluetooth$Stub$Proxy.getRemoteName (IBluetooth.java:2423)
  at android.bluetooth.BluetoothDevice.getName (BluetoothDevice.java:1015)
  at ee.aegrel.gadgetbridge.devices.{any coordinator}.getSupportedType ({any coordinator}.java:40)

or

"main" prio=5 tid=1 Native
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x73a50ed8 self=0x781b0c0a00
  | sysTid=8344 nice=-10 cgrp=default sched=0/0 handle=0x782038e9c8
  | state=S schedstat=( 0 0 0 ) utm=1780 stm=959 core=2 HZ=100
  | stack=0x7ff4525000-0x7ff4527000 stackSize=8MB
  | held mutexes=
  #00  pc 000000000001db2c  /system/lib64/libc.so (syscall+28)
  #01  pc 00000000000e1f20  /system/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+152)
  #02  pc 00000000004e2140  /system/lib64/libart.so (art::GoToRunnable(art::Thread*)+440)
  #03  pc 00000000004e1f40  /system/lib64/libart.so (art::JniMethodEnd(unsigned int, art::Thread*)+28)
  #04  pc 0000000000994d1c  /system/framework/arm64/boot-framework.oat (Java_android_os_BinderProxy_transactNative__ILandroid_os_Parcel_2Landroid_os_Parcel_2I+220)
  at android.os.BinderProxy.transactNative (BinderProxy.java)
  at android.os.BinderProxy.transact (BinderProxy.java:763)
  at android.bluetooth.IBluetooth$Stub$Proxy.getRemoteName (IBluetooth.java:2203)
  at android.bluetooth.BluetoothDevice.getName (BluetoothDevice.java:1213)
  at ee.aegrel.gadgetbridge.impl.GBDeviceCandidate.getName (GBDeviceCandidate.java:150)

or

"main" prio=5 tid=1 Native
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x70fa01f0 self=0xf2109800
  | sysTid=16825 nice=0 cgrp=default sched=0/0 handle=0xf2765dd4
  | state=S schedstat=( 55620146161 3793222702 139612 ) utm=3816 stm=1745 core=4 HZ=100
  | stack=0xff713000-0xff715000 stackSize=8192KB
  | held mutexes=
  #00  pc 000000000005b7b0  /apex/com.android.runtime/lib/bionic/libc.so (syscall+28)
  #01  pc 00000000000e44e5  /apex/com.android.runtime/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+80)
  #02  pc 0000000000417631  /apex/com.android.runtime/lib/libart.so (art::GoToRunnable(art::Thread*) (.llvm.7602495949844778418)+324)
  #03  pc 00000000004174c5  /apex/com.android.runtime/lib/libart.so (art::JniMethodEnd(unsigned int, art::Thread*)+8)
  at android.os.BinderProxy.transactNative (BinderProxy.java)
  at android.os.BinderProxy.transact (BinderProxy.java:527)
  at android.bluetooth.IBluetooth$Stub$Proxy.getRemoteName (IBluetooth.java:3826)
  at android.bluetooth.BluetoothDevice.getName (BluetoothDevice.java:1452)
  at android.bluetooth.BluetoothDevice.getAliasName (BluetoothDevice.java:1544)
  at java.lang.reflect.Method.invoke (Method.java)
  at ee.aegrel.gadgetbridge.impl.GBDeviceCandidate.getName (GBDeviceCandidate.java:144)

It seems that Android’s BluetoothDevice.getName() either causes excessive load or just blocks for too long. It would be nice to have an alternative solution for this problem, one possibility being not calling any functions that use BluetoothDevice.getName() on the main thread.

--- name: Bug report about: Android BluetoothDevice getName causes ANRs --- #### Your issue is: ``` "main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 flags=1 obj=0x7120dd98 self=0x774c284c00 | sysTid=9825 nice=0 cgrp=default sched=0/0 handle=0x774d7e6ed0 | state=S schedstat=( 22342171300 1722057213 521104 ) utm=1149 stm=1084 core=0 HZ=100 | stack=0x7fe91a1000-0x7fe91a3000 stackSize=8192KB | held mutexes= #00 pc 000000000007f33c /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28) #01 pc 000000000014b094 /apex/com.android.runtime/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+148) #02 pc 000000000058f9b4 /apex/com.android.runtime/lib64/libart.so (art::GoToRunnable(art::Thread*) (.llvm.15732748762076278778)+460) #03 pc 000000000058f7a4 /apex/com.android.runtime/lib64/libart.so (art::JniMethodEnd(unsigned int, art::Thread*)+28) at android.os.BinderProxy.transactNative (BinderProxy.java) at android.os.BinderProxy.transact (BinderProxy.java:511) at android.bluetooth.IBluetooth$Stub$Proxy.getRemoteName (IBluetooth.java:2423) at android.bluetooth.BluetoothDevice.getName (BluetoothDevice.java:1015) at ee.aegrel.gadgetbridge.devices.{any coordinator}.getSupportedType ({any coordinator}.java:40) ``` or ``` "main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 flags=1 obj=0x73a50ed8 self=0x781b0c0a00 | sysTid=8344 nice=-10 cgrp=default sched=0/0 handle=0x782038e9c8 | state=S schedstat=( 0 0 0 ) utm=1780 stm=959 core=2 HZ=100 | stack=0x7ff4525000-0x7ff4527000 stackSize=8MB | held mutexes= #00 pc 000000000001db2c /system/lib64/libc.so (syscall+28) #01 pc 00000000000e1f20 /system/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+152) #02 pc 00000000004e2140 /system/lib64/libart.so (art::GoToRunnable(art::Thread*)+440) #03 pc 00000000004e1f40 /system/lib64/libart.so (art::JniMethodEnd(unsigned int, art::Thread*)+28) #04 pc 0000000000994d1c /system/framework/arm64/boot-framework.oat (Java_android_os_BinderProxy_transactNative__ILandroid_os_Parcel_2Landroid_os_Parcel_2I+220) at android.os.BinderProxy.transactNative (BinderProxy.java) at android.os.BinderProxy.transact (BinderProxy.java:763) at android.bluetooth.IBluetooth$Stub$Proxy.getRemoteName (IBluetooth.java:2203) at android.bluetooth.BluetoothDevice.getName (BluetoothDevice.java:1213) at ee.aegrel.gadgetbridge.impl.GBDeviceCandidate.getName (GBDeviceCandidate.java:150) ``` or ``` "main" prio=5 tid=1 Native | group="main" sCount=1 dsCount=0 flags=1 obj=0x70fa01f0 self=0xf2109800 | sysTid=16825 nice=0 cgrp=default sched=0/0 handle=0xf2765dd4 | state=S schedstat=( 55620146161 3793222702 139612 ) utm=3816 stm=1745 core=4 HZ=100 | stack=0xff713000-0xff715000 stackSize=8192KB | held mutexes= #00 pc 000000000005b7b0 /apex/com.android.runtime/lib/bionic/libc.so (syscall+28) #01 pc 00000000000e44e5 /apex/com.android.runtime/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+80) #02 pc 0000000000417631 /apex/com.android.runtime/lib/libart.so (art::GoToRunnable(art::Thread*) (.llvm.7602495949844778418)+324) #03 pc 00000000004174c5 /apex/com.android.runtime/lib/libart.so (art::JniMethodEnd(unsigned int, art::Thread*)+8) at android.os.BinderProxy.transactNative (BinderProxy.java) at android.os.BinderProxy.transact (BinderProxy.java:527) at android.bluetooth.IBluetooth$Stub$Proxy.getRemoteName (IBluetooth.java:3826) at android.bluetooth.BluetoothDevice.getName (BluetoothDevice.java:1452) at android.bluetooth.BluetoothDevice.getAliasName (BluetoothDevice.java:1544) at java.lang.reflect.Method.invoke (Method.java) at ee.aegrel.gadgetbridge.impl.GBDeviceCandidate.getName (GBDeviceCandidate.java:144) ``` It seems that Android's BluetoothDevice.getName() either causes excessive load or just blocks for too long. It would be nice to have an alternative solution for this problem, one possibility being not calling any functions that use `BluetoothDevice.getName()` on the main thread.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.