mapbox / mapbox/mapbox-maps-android

ANR occurs after calling #queryMapForFeatures

Open
#2,669 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle: needs info
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Android OS version: 5.1.1
- Devices affected: Rockchip RK3288 Develop Board.
- Maps SDK Version: 10.7.0

## Observed behavior and steps to reproduce

We try a lot times to replay the situation. But no error shows agains.
After tracing , we found a LOCK. After calling queryMapForFeatures then acquire this lock causing the whole system thread blocking. So i believe that would be the key point.

Here comes the ANR log which is indicated the API queryMapForFeatures.

`
ANR Info:
ANR in com.fj.smartkit (com.fj.smartkit/.gen3.main.NewMainContainerActivity)
PID: 14664
Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 21. Wait queue head age: 5544.6ms.)
Load: 2.37 / 1.2 / 1.07
CPU usage from 4558ms to -3719ms ago:
47% 14664/com.fj.smartkit: 26% user + 21% kernel / faults: 18282 minor 4 major
13% 455/system_server: 4.3% user + 8.6% kernel / faults: 5839 minor
4.1% 827/com.android.phone: 1.8% user + 2.2% kernel / faults: 3472 minor
0% 147/debuggerd: 0% user + 0% kernel / faults: 3536 minor
1.3% 598/com.android.systemui: 0.9% user + 0.3% kernel / faults: 2093 minor
0% 562/android.process.media: 0% user + 0% kernel / faults: 1553 minor
0.4% 135/logd: 0% user + 0.4% kernel
0.2% 34/kconsole: 0% user + 0.2% kernel
0.2% 18993/kworker/u8:0: 0% user + 0.2% kernel
0% 8/rcu_preempt: 0% user + 0% kernel
0.1% 98/mmcqd/0: 0% user + 0.1% kernel
0% 138/servicemanager: 0% user + 0% kernel
0.1% 19181/kworker/0:2: 0% user + 0.1% kernel
18% TOTAL: 9.1% user + 9.4% kernel + 0.1% iowait + 0% softirq
CPU usage from 3185ms to 3702ms later:
98% 14664/com.fj.smartkit: 25% user + 73% kernel / faults: 1203 minor
96% 14673/Signal Catcher: 26% user + 69% kernel
3.8% 455/system_server: 1.9% user + 1.9% kernel / faults: 4 minor
1.9% 478/ActivityManager: 1.9% user + 0% kernel
1.6% 827/com.android.phone: 0% user + 1.6% kernel / faults: 5 minor
1.7% 19181/kworker/0:2: 0% user + 1.7% kernel
27% TOTAL: 8.2% user + 18% kernel

--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
anr traces:
generate begin time: 2025-08-25 18:18:09
[DEBUG] dump art internal: 67
[DEBUG] VMExt: 0xb7099130, i: 58, str: 3
[DEBUG] runtime trace: 33,20,/data/anr/traces.txt
[DEBUG] aborting: 0xb5286afc, 0
[DEBUG] Dump: 0x0, State: 0xb51b6f35, JavaStack: 0xb51b5831
[DEBUG] Thread spec key: 0xb5288004
[DEBUG] current: 0xb70992e0, pid: 19237
[DEBUG] List: 0xb7090448
[DEBUG] Each: 0xb51bca1d
[DEBUG] err: 0xb5da5e60
[DEBUG] begin each
[DEBUG] dumping 0xb70992e0 ...
"main" prio=5 tid=1 TimedWaiting
| group="" sCount=0 dsCount=0 obj=0x74974d68 self=0xb70992e0
| sysTid=14664 nice=0 cgrp=default sched=0/0 handle=0xb6fedbec
| state=? schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
| stack=0xbe059000-0xbe05b000 stackSize=8MB
| held mutexes=
at java.lang.Object.wait!(Native method)
- waiting on <0x0a6f9c08> (a java.lang.Object)
at java.lang.Thread.parkFor(Thread.java:1220)
- locked <0x0a6f9c08> (a java.lang.Object)
at sun.misc.Unsafe.park(Unsafe.java:299)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:197)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1014)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1304)
at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:248)
at com.mapbox.maps.plugin.annotation.AnnotationManagerImpl.queryMapForFeatures(AnnotationManagerImpl.kt:816)
at com.mapbox.maps.plugin.annotation.AnnotationManagerImpl.queryMapForFeatures(AnnotationManagerImpl.kt:768)
at com.mapbox.maps.plugin.annotation.AnnotationManagerImpl$MapClick.onMapClick(AnnotationManagerImpl.kt:602)
at com.mapbox.maps.plugin.gestures.GesturesPluginImpl.handleClickEvent$plugin_gestures_release(GesturesPluginImpl.kt:1231)
at com.mapbox.maps.plugin.gestures.GesturesPluginImpl$StandardGestureListener.onSingleTapConfirmed(GesturesPluginImpl.kt:441)
at com.mapbox.android.gestures.StandardGestureDetector$1.onSingleTapConfirmed(StandardGestureDetector.java:83)
at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:275)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5280)
at java.lang.reflect.Method.invoke!(Native method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:963)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:758)

## Expected behavior

Nothing happened. Normally close page and show the top activity.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with AnnotationManagerImpl.kt at queryMapForFeatures, especially the CountDownLatch.await stack frame, then trace the MapClick.onMapClick call path. Reproduce or inspect the ANR on Android 5.1.1 with Maps SDK 10.7.0 and determine whether this path blocks the main thread. Done means the reported interaction no longer causes an ANR when closing the page or returning to the top activity.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.