seemoo-lab / AirGuard

Protect yourself from being tracked 🌍 by AirTags 🏷 and Find My accessories 📍
Apache License 2.0
1.96k stars 110 forks source link

OutOfMemoryError crash on GrapheneOS #90

Closed RobertKosten closed 1 year ago

RobertKosten commented 2 years ago

Recently AirGuard started crashing with an SQLite OutOfMemoryError on my GrapheneOS Pixel 4:

type: crash
osVersion: google/flame/flame:13/TP1A.221005.002/2022102600:user/release-keys
package: de.seemoo.at_tracking_detection:35
process: de.seemoo.at_tracking_detection

java.lang.OutOfMemoryError: Failed to allocate a 32 byte allocation with 1301384 free bytes and 1270KB until OOM, target footprint 536870912, growth limit 536870912; giving up on allocation because <1% of heap free after GC.
    at android.database.sqlite.SQLiteDatabase.createSession(SQLiteDatabase.java:600)
    at android.database.sqlite.SQLiteDatabase$$ExternalSyntheticLambda0.get(Unknown Source:2)
    at java.lang.ThreadLocal$SuppliedThreadLocal.initialValue(ThreadLocal.java:284)
    at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:180)
    at java.lang.ThreadLocal.get(ThreadLocal.java:170)
    at android.database.sqlite.SQLiteDatabase.getThreadSession(SQLiteDatabase.java:591)
    at android.database.sqlite.SQLiteDatabase.inTransaction(SQLiteDatabase.java:787)
    at f4.a.M(Unknown Source:2)
    at a4.r.inTransaction(Unknown Source:6)
    at androidx.room.c$a.run(Unknown Source:54)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    at java.lang.Thread.run(Thread.java:1012)
RobertKosten commented 2 years ago

I'm not sure yet, but it might be related to placing it on the wireless (Qi) charging dock (Anker PowerWave Stand).

Sn0wfreezeDev commented 1 year ago

These issues are very hard to debug on Android. Almost all crashes we get in our crash logs are Memory related. If anyone has good ideas how to identify which parts might cause this, we are open for help here

n1snt commented 1 year ago

We should try using LeakCanary to find the probable cause of the leak.

Sn0wfreezeDev commented 1 year ago

I already used LeakCanary to look for memory issues, but nothing special was reported that I could act on. These memory issues are quite hard to catch.