Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Untraceable fatal Exception caused by java.lang.IllegalArgumentException: byteString == null #2281

Closed
marcusmotill opened this issue Jan 26, 2016 · 14 comments
Labels
bug Bug in existing code needs info More information needed from reporter

Comments

@marcusmotill
Copy link

Originally in Retrofit issues, Jake told me to post this here:

From time to time I am experiencing this fatal error when performing a request. It only happens to one request at a time and I cannot get it to go away until I uninstall and reinstall the application. I am using:
com.squareup.retrofit2:retrofit:2.0.0-beta3

and here is the error:

E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher 
    Process: package_name, PID: 4804 
    java.lang.IllegalArgumentException: byteString == null 
    at okio.Buffer.write(Buffer.java:787)
    at com.squareup.okhttp.Cache$Entry.readCertificateList(Cache.java:628)
    at com.squareup.okhttp.Cache$Entry.<init>(Cache.java:555)
    at com.squareup.okhttp.Cache.get(Cache.java:194)
    at com.squareup.okhttp.Cache$1.get(Cache.java:139)
    at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:226) 
    at com.squareup.okhttp.Call.getResponse(Call.java:267) 
    at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:224) 
    at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:195) 
    at com.squareup.okhttp.Call.access$100(Call.java:34) 
    at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:162) 
    at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
    at java.lang.Thread.run(Thread.java:818)

Let me know if you need more information

EDIT: I was able to get the error to stop if I went to system setting and cleared the app cache manually

@swankjesse
Copy link
Collaborator

Somehow your cache is being corrupted. Are you able to reproduce?

@swankjesse swankjesse added bug Bug in existing code needs info More information needed from reporter labels Feb 21, 2016
@marcusmotill
Copy link
Author

Unable to reproduce. Seems to happen randomly

On Sun, Feb 21, 2016, 12:14 PM Jesse Wilson notifications@github.com
wrote:

Somehow your cache is being corrupted. Are you able to reproduce?


Reply to this email directly or view it on GitHub
#2281 (comment).

Marcus Motill
University of Louisville
C: (561) 339-4465

@swankjesse
Copy link
Collaborator

No clear action for us to take here. If you can figure out how to reproduce this, please let us know.

@marcusmotill
Copy link
Author

Sounds good. Thanks for looking into it

On Sun, Feb 21, 2016 at 9:44 PM Jesse Wilson notifications@github.com
wrote:

No clear action for us to take here. If you can figure out how to
reproduce this, please let us know.


Reply to this email directly or view it on GitHub
#2281 (comment).

Marcus Motill
University of Louisville
C: (561) 339-4465

@oleg-nenashev
Copy link

It has been also reported here: hub4j/github-api#265 (effectively, from one of Jenkins plugins).

CC @ligi . Maybe he could provide reproduction steps

@KostyaSha
Copy link

Reproduced, have test case ;)

@niqo01
Copy link

niqo01 commented Oct 30, 2017

Not reproducible for me just to add it's happening on Motorola Marshmallow for me: http://crashes.to/s/e86f7ac4202

@martin-academia
Copy link

I have started seeing a similar crash in my app in the field, being reported by Firebase. Since I don't have a device with the problem in front of me I can't get a lot more information. I am using retrofit:2.7.0,

But the stack trace is similar:

Fatal Exception: java.lang.IllegalArgumentException
byteString == null

okio.Buffer.write (Buffer.java:955)
okhttp3.Cache$Entry.readCertificateList (Cache.java:668)
okhttp3.Cache$Entry. (Cache.java:581)
okhttp3.Cache.get (Cache.java:208)
okhttp3.Cache$1.get (Cache.java:145)
okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor.java:55)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:142)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:117)
okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.java:93)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:142)
okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (RetryAndFollowUpInterceptor.java:88)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:142)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:117)
okhttp3.logging.HttpLoggingInterceptor.intercept (HttpLoggingInterceptor.java:144)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:142)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:117)
com.instabug.library.okhttplogger.InstabugOkhttpInterceptor.populateNetworkResponse (InstabugOkhttpInterceptor.java:236)
com.instabug.library.okhttplogger.InstabugOkhttpInterceptor.intercept (InstabugOkhttpInterceptor.java:92)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:142)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:117)
com.academia.network.NetworkModel$okHttpClient$1$1.intercept (NetworkModel.kt:121)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:142)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:117)
com.academia.network.AuthInterceptor.intercept (AuthInterceptor.kt:52)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:142)
okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:117)
okhttp3.RealCall.getResponseWithInterceptorChain (RealCall.java:229)
okhttp3.RealCall$AsyncCall.execute (RealCall.java:172)
okhttp3.internal.NamedRunnable.run (NamedRunnable.java:32)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)

@yschimke
Copy link
Collaborator

yschimke commented Oct 13, 2020

@martin-academia which version of OkHttp are you using? The error suggests a corrupted cache entry, so either we try to work out root cause (code, or external factors) or improve error handling for this case.

bytes.write(ByteString.decodeBase64(line));

Ideally we would need a reproduction with 4.9.0 or 3.12.12? I know that might be hard if you can't repro yourself.

@martin-academia
Copy link

Oh interesting, we didn't have an explicit dependency on OkHttp in our build.gradle, so I assume we were getting some default from retrofit 2.7.0.
I just tried moving to 4.9.0 and ran into compile problems, so until I can migrate I'm going to stay in version 3. As far as I can tell the latest 3.x.x is 3.14.0, so I'm explicitly including that. I'll let you know if we get more repros with that version.

@martin-academia
Copy link

One thing I noticed: When we were constructing the OkHttpClient, we created the cache with context.cacheDir as the directory. I didn't realize until I just looked at it that it's putting its cache files directly in that directory. Our app may be putting other stuff in that directory as well, so there is the potential for a collision.
I'm not sure whether that's the problem or not, but it seems unsafe so I'm going to change my app to put the OkHttp cache in some subdirectory of context.cacheDir.

@yschimke
Copy link
Collaborator

That's a great data point. 3.14 isn't maintained. So we would fix a bug on 4.x (Kotlin and Android 5+) or 3.12.x (legacy Android)

@nikhiljainlive
Copy link

We are facing daily crashes because of this issue. Is there any update on this?

@yschimke
Copy link
Collaborator

yschimke commented Jan 4, 2022

We don't have a reproduction for this, the suggested one above turned out not to be the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in existing code needs info More information needed from reporter
Projects
None yet
Development

No branches or pull requests

8 participants