goon/mobile/patches/expo-modules-core+2.2.3.patch
goon-foss ca2a6a1547 fix: dzienny ingest filmow nie przepada o 05:00, apka nie staje na bledzie keystore
- scheduler: misfire_grace_time 1 h zamiast domyslnej 1 s. O 05:00 UTC startuje kilkanascie
  zadan naraz, movie-ingest dostawal watek 1,1 s po czasie i APScheduler go pomijal, wiec
  filmy nie przychodzily od 17.09 (watchdog, Sentry).
- getDeviceId: blad SecureStore ("Could not encrypt the value", Samsung A7, Android 10)
  wywalal kazde zapytanie do API. Teraz id zostaje w pamieci do konca sesji. Wejdzie z
  najblizsza paczka OTA.
- latka expo-modules-core 2.2.3, JNIDeallocator: watek sprzatajacy blokowal sie na sobie,
  nie na deallocatorze, stad ConcurrentModificationException przy przeladowaniu JS
  (Sentry GOON-48). Wejdzie z najblizszym APK.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-22 12:00:11 +02:00

31 lines
1.8 KiB
Diff

diff --git a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/jni/JNIDeallocator.kt b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/jni/JNIDeallocator.kt
--- a/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/jni/JNIDeallocator.kt
+++ b/node_modules/expo-modules-core/android/src/main/java/expo/modules/kotlin/jni/JNIDeallocator.kt
@@ -34,7 +34,10 @@ class JNIDeallocator(shouldCreateDestructorThread: Boolean = true) : AutoCloseab
// Referent of PhantomReference were garbage collected so we can remove it from our registry.
// Note that we don't have to call `deallocate` method - it was called [com.facebook.jni.HybridData].
val current = referenceQueue.remove()
- synchronized(this) {
+ // Goon: `this` w `object : Thread` to watek, nie deallocator. Blokada na watku
+ // nic nie chronila i remove szedl rownolegle z iteracja w deallocate(), stad
+ // ConcurrentModificationException przy przeladowaniu JS (Sentry GOON-48).
+ synchronized(this@JNIDeallocator) {
destructorMap.remove(current)
}
} catch (e: InterruptedException) {
@@ -65,10 +68,13 @@ class JNIDeallocator(shouldCreateDestructorThread: Boolean = true) : AutoCloseab
* Deallocates valid references and clears the internal registry.
*/
internal fun deallocate() = synchronized(this) {
- destructorMap.values.forEach {
+ // Goon: kopia przed wolaniem deallocate(), ktore moze wrocic do tej mapy z tego
+ // samego watku (blokada jest reentrant, wiec by nie zatrzymala), GOON-48.
+ val refs = destructorMap.values.toList()
+ destructorMap.clear()
+ refs.forEach {
it.get()?.deallocate()
}
- destructorMap.clear()
destructorThread?.interrupt()
}