googlemaps / android-maps-compose

Jetpack Compose composables for the Maps SDK for Android
https://developers.google.com/maps/documentation/android-sdk/maps-compose
Apache License 2.0
1.16k stars 142 forks source link

ANR when using Clustering with 1000 items only #556

Open spss20 opened 7 months ago

spss20 commented 7 months ago

Environment details

  1. maps-compose
  2. Android 13
  3. 4.3.3

Steps to reproduce

Load map with Clustering containing 1000 items in densed area

Code example

@OptIn(MapsComposeExperimentalApi::class)
@Composable
fun MainView(modifier: Modifier = Modifier) {
    val cameraPosition = rememberCameraPositionState {
        position = CameraPosition.fromLatLngZoom(getRandomPosition(), 9f)
    }

    val stationsList = remember {
        mutableStateListOf<StationItem>()
    }

    println("Recomposition")
    LaunchedEffect(Unit) {
        for (i in 1..1000) {
            val position = getRandomPosition();
            stationsList.add(
                StationItem(
                    position, "Marker $i",
                    "Snipper", 0f
                )
            )
        }
    }

    GoogleMap(modifier = modifier, cameraPositionState = cameraPosition) {
        Clustering(items = stationsList)
    }
}

fun getRandomPosition(): LatLng {
    return LatLng(
        28.354945 + Random.nextFloat(),
        76.948420 + Random.nextFloat()
    );
}
spss20 commented 7 months ago

2024-04-19 18:06:12.298 8927-9204 ProxyAndro...gerBackend com.ssoftwares.chargepe W Too many Flogger logs received before configuration. Dropping old logs. 2024-04-19 18:06:12.299 8927-9204 ProxyAndro...gerBackend com.ssoftwares.chargepe W Too many Flogger logs received before configuration. Dropping old logs. 2024-04-19 18:06:12.325 8927-9203 ProxyAndro...gerBackend com.ssoftwares.chargepe W Too many Flogger logs received before configuration. Dropping old logs. 2024-04-19 18:06:12.325 8927-9203 ProxyAndro...gerBackend com.ssoftwares.chargepe W Too many Flogger logs received before configuration. Dropping old logs. 2024-04-19 18:06:12.710 8927-8927 Quality com.ssoftwares.chargepe I Skipped: false 10 cost 175.73158 refreshRate 16655841 bit true processName com.ssoftwares.chargepe 2024-04-19 18:06:13.105 8927-8927 Quality com.ssoftwares.chargepe I Skipped: true 1 cost 21.104652 refreshRate 16657725 bit true processName com.ssoftwares.chargepe 2024-04-19 18:06:14.083 1618-9111 ActivityManager system_server E ANR in com.ssoftwares.chargepe (com.ssoftwares.chargepe/.MainActivity) PID: 8927 Reason: Input dispatching timed out (c7a0db6 com.ssoftwares.chargepe/com.ssoftwares.chargepe.MainActivity (server) is not responding. Waited 5000ms for MotionEvent) Parent: com.ssoftwares.chargepe/.MainActivity ErrorId: 2302ef1a-d394-4b66-b408-d626c0834645 Frozen: false Load: 24.19 / 24.09 / 24.07 ----- Output from /proc/pressure/memory ----- some avg10=0.00 avg60=0.00 avg300=0.13 total=1037455014 full avg10=0.00 avg60=0.00 avg300=0.00 total=317408045 ----- End output from /proc/pressure/memory -----

                                                                                                CPU usage from 0ms to 6512ms later (2024-04-19 18:06:07.477 to 2024-04-19 18:06:13.989):
                                                                                                  229% 8927/com.ssoftwares.chargepe: 210% user + 19% kernel / faults: 72350 minor 6 major
                                                                                                  41% 1618/system_server: 22% user + 19% kernel / faults: 22321 minor 115 major
                                                                                                  0.1% 1381/media.swcodec: 0% user + 0% kernel / faults: 16098 minor 114 major
                                                                                                  7.7% 605/logd: 1.5% user + 6.2% kernel / faults: 800 minor
                                                                                                  7.3% 976/surfaceflinger: 4.7% user + 2.5% kernel / faults: 1136 minor 3 major
                                                                                                  6.8% 2528/com.android.phone: 4.4% user + 2.4% kernel / faults: 3668 minor 103 major
                                                                                                  6.2% 2320/com.android.systemui: 4.5% user + 1.6% kernel / faults: 1078 minor
                                                                                                  6% 23237/com.android.launcher: 3.6% user + 2.4% kernel / faults: 18541 minor 4 major
                                                                                                  2.8% 884/android.hardware.media.c2@1.2-mediatek: 1.8% user + 0.9% kernel / faults: 6266 minor 20 major
                                                                                                  3.6% 878/android.hardware.graphics.composer@2.3-service: 1.2% user + 2.4% kernel / faults: 383 minor 9 major
                                                                                                  2.8% 3558/adbd: 0.7% user + 2.1% kernel / faults: 34 minor
                                                                                                  0.3% 19741/kworker/X26:6-kverityd: 0% user + 0.3% kernel
                                                                                                  0.3% 166/kswapd0: 0% user + 0.3% kernel
                                                                                                  0% 5151/com.google.android.providers.media.module: 0% user + 0% kernel / faults: 3322 minor 167 major
                                                                                                  0.2% 167/kshrink_slabd: 0% user + 0.2% kernel
                                                                                                  0% 1172/media.extractor: 0% user + 0% kernel / faults: 4228 minor 41 major
                                                                                                  0% 1261/media.codec: 0% user + 0% kernel / faults: 2691 minor 23 major
                                                                                                  1.6% 22010/com.google.android.gms.persistent: 0.9% user + 0.7% kernel / faults: 90 minor
                                                                                                  1.5% 349/irq/205-5-0034: 0% user + 1.5% kernel
                                                                                                  1.5% 8906/kworker/X26:0-kverityd: 0% user + 1.5% kernel
                                                                                                  1.5% 20139/kworker/u24:0-ged_fence: 0% user + 1.5% kernel
                                                                                                  1.5% 21103/kworker/X26:9-kverityd: 0% user + 1.5% kernel
                                                                                                  1.3% 895/vendor.mediatek.hardware.mtkpower@1.0-service: 0.3% user + 1% kernel / faults: 89 minor 2 major
                                                                                                  1.3% 8217/kworker/u24:4-adb: 0% user + 1.3% kernel
                                                                                                  1.3% 29001/logcat: 0.4% user + 0.9% kernel
                                                                                                  0.1% 4978/kworker/X26:8-kverityd: 0% user + 0.1% kernel
                                                                                                  1% 589/kworker/u24:5-events_unbound: 0% user + 1% kernel
                                                                                                  1% 1661/mtkfusionrild: 0.7% user + 0.3% kernel
                                                                                                  0% 4895/com.oplus.olc: 0% user + 0% kernel / faults: 1336 minor 54 major
                                                                                                  1% 8189/irq/215-touchpa: 0% user + 1% kernel
                                                                                                  1% 15887/kworker/X26:1-kverityd: 0% user + 1% kernel
                                                                                                  0.9% 887/android.hardware.sensors@2.0-service.multihal-mediatek: 0.4% user + 0.4% kernel / faults: 67 minor 2 major
                                                                                                  0% 4901/com.oplus.audio.effectcenter: 0% user + 0% kernel / faults: 1616 minor 71 major
                                                                                                  0.9% 10698/com.oplus.midas: 0.3% user + 0.6% kernel / faults: 387 minor
                                                                                                  0.4% 1/init: 0.1% user + 0.2% kernel / faults: 178 minor
                                                                                                  0% 722/loop12: 0% user + 0% kernel
                                                                                                  0.7% 6938/com.oplus.onetrace: 0.1% user + 0.6% kernel / faults: 69 minor
                                                                                                  0.7% 16608/process-tracker: 0.1% user + 0.6% kernel / faults: 7 minor
                                                                                                  0.7% 16611/process-tracker: 0% user + 0.7% kernel / faults: 4 minor
                                                                                                  0.7% 24697/com.oplus.crashbox: 0% user + 0.7% kernel / faults: 552 minor 3 major
                                                                                                  0.6% 607/servicemanager: 0.4% user + 0.1% kernel / faults: 16 minor 2 major
                                                                                                  0% 696/tombstoned: 0% user + 0% kernel / faults: 16 minor 51 major
                                                                                                  0.6% 848/statsd: 0.6% user + 0% kernel / faults: 187 minor 12 major
                                                                                                  0.6% 2562/com.oplus.subsys: 0.1% user + 0.4% kernel / faults: 107 minor 4 major
                                                                                                  0.2% 238/pbm: 0% user + 0.2% kernel
                                                                                                  0.2% 662/android.system.suspend@1.0-service: 0% user + 0.2% kernel / faults: 92 minor 12 major
                                                                                                  0% 725/loop13: 0% user + 0% kernel

2024-04-19 18:06:14.083 1618-9111 ActivityManager system_server E 0% 25064/com.google.android.gms.persistent: 0% user + 0% kernel / faults: 15 minor 0% 31642/kworker/4:2: 0% user + 0% kernel 0% 31681/kworker/2:1-sock_diag_events: 0% user + 0% kernel +0% 9322/kworker/u25:3-mali_jd: 0% user + 0% kernel +0% 9323/kworker/u25:4-mali_jd: 0% user + 0% kernel +0% 9324/kworker/u25:6-fsverity_read_queue: 0% user + 0% kernel +0% 9325/kworker/u25:7-mali_jd: 0% user + 0% kernel +0% 9326/kworker/u25:8-mali_jd: 0% user + 0% kernel +0% 9359/kworker/X26:2-kverityd: 0% user + 0% kernel 57% TOTAL: 37% user + 17% kernel + 0.6% iowait + 2.1% irq + 0.6% softirq CPU usage from 86ms to 456ms later (2024-04-19 18:06:07.563 to 2024-04-19 18:06:07.934) with 99% awake: 124% 8927/com.ssoftwares.chargepe: 116% user + 7.5% kernel / faults: 726 minor 97% 8927/twares.chargepe: 93% user + 3.7% kernel 22% 9055/pool-6-thread-1: 22% user + 0% kernel 3.7% 8936/Jit thread pool: 0% user + 3.7% kernel 3.7% 9009/GL-Map: 3.7% user + 0% kernel 92% 605/logd: 8.6% user + 83% kernel / faults: 499 minor 20% 9157/logd.reader.per: 0% user + 20% kernel +0% 9184/logd.reader.per: 0% user + 0% kernel 69% 1618/system_server: 34% user + 34% kernel / faults: 1077 minor 34% 9111/AnrConsumer: 12% user + 22% kernel 6.3% 1788/android.bg: 0% user + 6.3% kernel 6.3% 2911/binder:1618_D: 3.1% user + 3.1% kernel 3.1% 1618/system_server: 0% user + 3.1% kernel 3.1% 1798/BroadcastQueue: 0% user + 3.1% kernel 3.1% 2045/InputDispatcher: 3.1% user + 0% kernel 3.1% 2192/oSenseHandler: 0% user + 3.1% kernel 3.1% 2489/OplusResHandler: 3.1% user + 0% kernel 3.1% 2941/binder:1618_E: 3.1% user + 0% kernel 9.7% 2320/com.android.systemui: 6.4% user + 3.2% kernel / faults: 95 minor 6.4% 2320/ndroid.systemui: 3.2% user + 3.2% kernel 3.2% 2641/RenderThread: 3.2% user + 0% kernel 6% 976/surfaceflinger: 3% user + 3% kernel / faults: 26 minor 3% 1516/binder:976_4: 0% user + 3% kernel 6.5% 2528/com.android.phone: 3.2% user + 3.2% kernel / faults: 93 minor 3.2% 2528/m.android.phone: 0% user + 3.2% kernel 2.7% 11/rcu_preempt: 0% user + 2.7% kernel 2.7% 48/ksoftirqd/6: 0% user + 2.7% kernel 2.7% 131/irq/323-mt6358-: 0% user + 2.7% kernel 2.9% 848/statsd: 2.9% user + 0% kernel 2.9% 861/Binder:statsd: 2.9% user + 0% kernel 2.9% 1884/statsd.writer: 0% user + 2.9% kernel 2.9% 887/android.hardware.sensors@2.0-service.multihal-mediatek: 2.9% user + 0% kernel 3.2% 2245/hif_thread: 0% user + 3.2% kernel 4.1% 23237/com.android.launcher: 0% user + 4.1% kernel +0% 9173/sh: 0% user + 0% kernel +0% 9180/logcat: 0% user + 0% kernel 85% TOTAL: 37% user + 45% kernel + 2% irq + 0.6% softirq