On our production app, we got some reports from users that game crashes sometimes. After checking google play console’s crash reports, we noticed that there seems like some problem exists within unity ads caching library on Android 10, Galaxy S 10+.(Unity 2017.4 LTS 35f)
Here’s the crash report :
java.lang.Error: FATAL EXCEPTION [UnityAdsCacheThread]
Unity version : 2017.4.35f1
Device model : samsung SM-G975N
at java.util.zip.Inflater.ensureOpen (Inflater.java:416)
at java.util.zip.Inflater.inflate (Inflater.java:276)
at com.android.okhttp.okio.InflaterSource.read (InflaterSource.java:69)
at com.android.okhttp.okio.GzipSource.read (GzipSource.java:82)
at com.android.okhttp.okio.RealBufferedSource$1.read (RealBufferedSource.java:397)
at java.io.BufferedInputStream.fill (BufferedInputStream.java:248)
at java.io.BufferedInputStream.read1 (BufferedInputStream.java:288)
at java.io.BufferedInputStream.read (BufferedInputStream.java:347)
at java.io.FilterInputStream.read (FilterInputStream.java:107)
at com.unity3d.ads.request.WebRequest.makeStreamRequest (WebRequest.java:190)
at com.unity3d.ads.cache.CacheThreadHandler.downloadFile (CacheThreadHandler.java:127)
at com.unity3d.ads.cache.CacheThreadHandler.handleMessage (CacheThreadHandler.java:62)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at com.unity3d.ads.cache.CacheThread.run (CacheThread.java:47)
It seems like not EVERY users are affected from this crash, but any workarounds or fixes will be appreciated. Thanks!
java.lang.Error:
FATAL EXCEPTION [UnityAdsCacheThread]
Unity version : 2019.1.13f1
Device model : samsung SM-G973F
Caused by
at java.util.zip.Inflater.ensureOpen (Inflater.java:416)
at java.util.zip.Inflater.inflate (Inflater.java:276)
at com.android.okhttp.okio.InflaterSource.read (InflaterSource.java:69)
at com.android.okhttp.okio.GzipSource.read (GzipSource.java:82)
at com.android.okhttp.okio.RealBufferedSource$1.read (RealBufferedSource.java:397)
at java.io.BufferedInputStream.fill (BufferedInputStream.java:248)
at java.io.BufferedInputStream.read1 (BufferedInputStream.java:288)
at java.io.BufferedInputStream.read (BufferedInputStream.java:347)
at java.io.FilterInputStream.read (FilterInputStream.java:107)
at com.unity3d.services.core.request.WebRequest.makeStreamRequest (WebRequest.java:190)
at com.unity3d.services.core.cache.CacheThreadHandler.downloadFile (CacheThreadHandler.java:136)
at com.unity3d.services.core.cache.CacheThreadHandler.handleMessage (CacheThreadHandler.java:70)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at com.unity3d.services.core.cache.CacheThread.run (CacheThread.java:47)
java.lang.Error: FATAL EXCEPTION [UnityAdsCacheThread]
Unity version : 2019.1.14f1
Device model : samsung SM-N975F
Device fingerprint: samsung/d2sxx/d2s:10/QP1A.190711.020/N975FXXU1BSL7:user/release-keys
Caused by
at java.util.zip.Inflater.ensureOpen (Inflater.java:416)
at java.util.zip.Inflater.inflate (Inflater.java:276)
at com.android.okhttp.okio.InflaterSource.read (InflaterSource.java:69)
at com.android.okhttp.okio.GzipSource.read (GzipSource.java:82)
at com.android.okhttp.okio.RealBufferedSource$1.read (RealBufferedSource.java:397)
at java.io.BufferedInputStream.fill (BufferedInputStream.java:248)
at java.io.BufferedInputStream.read1 (BufferedInputStream.java:288)
at java.io.BufferedInputStream.read (BufferedInputStream.java:347)
at java.io.FilterInputStream.read (FilterInputStream.java:107)
at com.unity3d.services.core.request.WebRequest.makeStreamRequest (WebRequest.java:190)
at com.unity3d.services.core.cache.CacheThreadHandler.downloadFile (CacheThreadHandler.java:136)
at com.unity3d.services.core.cache.CacheThreadHandler.handleMessage (CacheThreadHandler.java:70)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:237)
at com.unity3d.services.core.cache.CacheThread.run (CacheThread.java:47)
It looks to be a fatal exception from a BufferedInputStream read call. While we don’t have a repro case for this, we believe there is a way to mitigate the crash event and are looking in to pushing out a fix in our next release. Ill try to keep you updated when I get the fix merged in and know the expected release it will go out with.
I switched to admob mediation and it forced me to remove unity ads sdk and use just admob-unity-mediation.
And now I see such error, still on Android 10 samsung devices:
Caused by java.lang.NullPointerException: Inflater has been closed
at java.util.zip.Inflater.ensureOpen + 416(Inflater.java:416)
at java.util.zip.Inflater.inflate + 276(Inflater.java:276)
at com.android.okhttp.okio.InflaterSource.read + 69(InflaterSource.java:69)
at com.android.okhttp.okio.GzipSource.read + 82(GzipSource.java:82)
at com.android.okhttp.okio.RealBufferedSource$1.read + 397(RealBufferedSource.java:397)
at java.io.BufferedInputStream.fill + 248(BufferedInputStream.java:248)
at java.io.BufferedInputStream.read1 + 288(BufferedInputStream.java:288)
at java.io.BufferedInputStream.read + 347(BufferedInputStream.java:347)
at java.io.FilterInputStream.read + 107(FilterInputStream.java:107)
at com.unity3d.services.core.request.WebRequest.makeStreamRequest + 190(WebRequest.java:190)
at com.unity3d.services.core.cache.CacheThreadHandler.downloadFile + 136(CacheThreadHandler.java:136)
at com.unity3d.services.core.cache.CacheThreadHandler.handleMessage + 70(CacheThreadHandler.java:70)
at android.os.Handler.dispatchMessage + 107(Handler.java:107)
at android.os.Looper.loop + 237(Looper.java:237)
at com.unity3d.services.core.cache.CacheThread.run + 47(CacheThread.java:47)
@Shefich Can you confirm which version of the ads sdk your using in mediation? We were never able to reproduce this issue locally, and still can’t but we adjusted some of the error handling logic around this stack trace in an attempt to better capture this exception and stop it from causing an ANR. That fix was pushed into the 3.4.2 ads sdk and so if your not using that in mediation, then you could still be hitting the same issue as with direct integration. If you are using that in mediation, then please let us know so that we can continue to investigate this issue.