Skip to content

Fix ConcurrentModificationException in GeofenceManager expiry purge#4581

Merged
shai-almog merged 1 commit intomasterfrom
codex/fix-concurrentmodificationexception-in-geofencemanager
Mar 1, 2026
Merged

Fix ConcurrentModificationException in GeofenceManager expiry purge#4581
shai-almog merged 1 commit intomasterfrom
codex/fix-concurrentmodificationexception-in-geofencemanager

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Iterating expiryTimes.entrySet() while removing expired entries caused a ConcurrentModificationException during GeofenceManager updates and construction, so the purge logic needed to stop mutating the map via the enhanced-for loop.

Description

  • Change GeofenceManager.purgeExpired() to iterate the expirations map with an explicit Iterator and call it.remove() when an entry is expired to avoid concurrent modification.
  • Add a regression test updatePurgesExpiredGeofencesWithoutConcurrentModification to GeofenceManagerTest that injects expired entries and asserts manager.update(...) does not throw and removes the expired geofences from tracked state.
  • Add a small reflective test helper setPrivateField used by the new test to set expiryTimes deterministically.

Testing

  • Ran the targeted unit tests with Java 8 using export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64; export PATH="$JAVA_HOME/bin:$PATH"; cd maven && mvn -pl core-unittests -am -DunitTests=true -Dmaven.javadoc.skip=true -Dtest=GeofenceManagerTest -DfailIfNoTests=false test and the GeofenceManagerTest suite passed (9 tests, 0 failures).
  • The Maven invocation produced existing project warnings about local systemPath artifacts but the targeted tests succeeded and the build completed with BUILD SUCCESS.

Codex Task

@github-actions
Copy link

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

@shai-almog
Copy link
Collaborator Author

shai-almog commented Feb 28, 2026

Android screenshot updates

Compared 32 screenshots: 31 matched, 1 updated.

  • landscape — updated screenshot. Screenshot differs (640x320 px, bit depth 8).

    landscape
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as landscape.png in workflow artifacts.

Native Android coverage

  • 📊 Line coverage: 7.31% (3719/50867 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 5.71% (18267/320093), branch 2.75% (857/31113), complexity 3.42% (1016/29746), method 6.03% (835/13858), class 9.83% (180/1831)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/712 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

@shai-almog
Copy link
Collaborator Author

shai-almog commented Feb 28, 2026

iOS screenshot updates

Compared 32 screenshots: 31 matched, 1 updated.

  • landscape — updated screenshot. Screenshot differs (2556x1179 px, bit depth 8).

    landscape
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as landscape.png in workflow artifacts.

Benchmark Results

  • VM Translation Time: 290 seconds
  • Compilation Time: 164 seconds

Detailed Performance Metrics

Metric Duration
Build Time Statistics
Setup & Unzip 22725 ms
Extract Extensions 13 ms
Google Services Setup 1 ms
Scan Classes 462 ms
Extract Libs 761 ms
Inject Build Hints 33 ms
Generate Unit Tests 3 ms
Generate Stubs 850 ms
Compile Stubs 1918 ms
Generate Icons 738 ms
Prepare ParparVM 143 ms
ParparVM Execution 183165 ms
Post-VM Setup 218 ms
CocoaPods 3881 ms
Finalize 22 ms
Total Time 214934 msMaven Overhead : 76000 ms
CocoaPods Install (Script) 1000 ms
Simulator Boot 66000 ms
Simulator Boot (Run) 3000 ms
App Install 15000 ms
App Launch 4000 ms
Test Execution 134000 ms

@shai-almog shai-almog merged commit 5a81a71 into master Mar 1, 2026
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant