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

StackOverflowError when add a networkInterceptors #2300

Closed
guobao90 opened this issue Jan 30, 2016 · 28 comments
Closed

StackOverflowError when add a networkInterceptors #2300

guobao90 opened this issue Jan 30, 2016 · 28 comments
Labels
bug Bug in existing code needs info More information needed from reporter

Comments

@guobao90
Copy link

java.lang.StackOverflowError
at java.lang.ThreadLocal.get(ThreadLocal.java:53)
at dalvik.system.BlockGuard.getThreadPolicy(BlockGuard.java:140)
at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:163)
at libcore.io.IoBridge.recvfrom(IoBridge.java:513)
at java.net.PlainSocketImpl.read(PlainSocketImpl.java:488)
at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
at okio.Okio$2.read(Okio.java:139)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:306)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:300)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:196)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:191)
at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:79)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:909)
at com.squareup.okhttp.internal.http.HttpEngine.access$300(HttpEngine.java:93)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:894)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.library_http.RequestInterceptor.intercept(RequestInterceptor.java:27)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:867)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:748)
at com.squareup.okhttp.Call.getResponse(Call.java:277)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:234)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:196)
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:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856)

the method in the HttpEngine and the RequestInterceptor chain.proceed() call each other

i add interceptor below this

mOkHttpClient.networkInterceptors().add(new RequestInterceptor(ctx));

this is the code of interceptor
`public class RequestInterceptor implements Interceptor {
private Context mCtx;

public RequestInterceptor(Context ctx) {
    mCtx = ctx;
}

@Override
public Response intercept(Chain chain) throws IOException {
    Request originalRequest = chain.request();
    if (originalRequest.body() == null) {
        return chain.proceed(originalRequest);
    }
    String url = originalRequest.urlString();
    if (!url.contains("distinctRequestId=")) {
        String requestId = OkHttpClientManager.getDistinctRequestId();
        if (url.contains("?")) {
            url = originalRequest.urlString() + "&distinctRequestId=" + requestId;
        } else {
            url = originalRequest.urlString() + "?distinctRequestId=" + requestId;
        }
        url = url + "&p=" + PreferenceUtils.getRequestId(mCtx) + "&span=" + PreferenceUtils.getConnectTime(mCtx);
        PreferenceUtils.setRequestId(mCtx, requestId);
        Request compressedRequest = originalRequest.newBuilder()
                .url(url)
                .build();
        return chain.proceed(compressedRequest);
    }
    return chain.proceed(originalRequest);
}

}
`

@swankjesse
Copy link
Member

Can you please isolate this into a test case? Will make it easier to diagnose & fix. Also does the problem happen in OkHttp 3?

@guobao90
Copy link
Author

hi swankjesse .I use the okhttp3 .It still happen .It crash sometime

@swankjesse
Copy link
Member

Could you isolate this into a test case?

@swankjesse swankjesse added the bug Bug in existing code label Feb 21, 2016
@swankjesse swankjesse added this to the 3.2 milestone Feb 21, 2016
@swankjesse swankjesse added the needs info More information needed from reporter label Feb 24, 2016
@swankjesse swankjesse removed this from the 3.2 milestone Feb 24, 2016
@broakenmedia
Copy link

Same issue here!

@broakenmedia
Copy link

@dave-r12
Copy link
Collaborator

@xbroak how are you adding your interceptors? Is it possible the code is accidentally adding the same interceptor over and over, causing the list to grow?

@broakenmedia
Copy link

@dave-r12

public static <S> S createService(Class<S> serviceClass) {
    HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
    interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
    httpClient = new OkHttpClient.Builder()
            .addInterceptor(interceptor)
            .build();
    retrofit = builder.client(httpClient).build();
    return retrofit.create(serviceClass);
}

Not being called in any loops however!

@dave-r12
Copy link
Collaborator

Thanks - it looks like that snippet is from OkHttp 3.X (OkHttpClient.Builder). The stack trace appears to be using classes from 2.7, notably the com.squareup.okhttp package. Maybe an older version of the app?

@broakenmedia
Copy link

@dave-r12 No sorry, i updated the libraries on the same day in an attempt to fix the problem is all!

@broakenmedia
Copy link

Absolutely at a loss on this one. Have spent all day attempting to find the source of this problem with no luck. My above code is only called ONCE in OnCreate and nowhere else. Not sure what's going on here.

Edit: Have also got a second error with the same cause: http://crashes.to/s/eda24c48e4d

@dave-r12
Copy link
Collaborator

Do you still have the 2.7 code around? I think the code you posted for 3.X looks right. That latest stack trace is also using 2.7.

@iNoles
Copy link
Contributor

iNoles commented Feb 29, 2016

you have three

return chain.proceed(originalRequest);

@broakenmedia
Copy link

@dave-r12 The problem is happening on both 2.7 and 3, i have two apps is all! Here's the code however just in case:

private static OkHttpClient httpClient = new OkHttpClient();
public static <S> S createService(String baseURL, Class<S> serviceClass) {
    HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
    interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
    httpClient.interceptors().add(interceptor);
    retrofit = getBuilder(baseURL).client(httpClient).build();

    return retrofit.create(serviceClass);
}

@iNoles
Copy link
Contributor

iNoles commented Feb 29, 2016

@xbroak try

public class RequestInterceptor implements Interceptor {
    private Context mCtx;

    public RequestInterceptor(Context ctx) {
        mCtx = ctx;
    }

    @Override
    public Response intercept(Chain chain) throws IOException {
        Request originalRequest = chain.request();
        if (originalRequest.body() == null) {
            return chain.proceed(originalRequest);
        }

        String url = originalRequest.urlString();
        if (!url.contains("distinctRequestId=")) {
            String requestId = OkHttpClientManager.getDistinctRequestId();
            if (url.contains("?")) {
                url = originalRequest.urlString() + "&distinctRequestId=" + requestId;
            } else {
                url = originalRequest.urlString() + "?distinctRequestId=" + requestId;
            }
        }
        url = url + "&p=" + PreferenceUtils.getRequestId(mCtx) + "&span=" + PreferenceUtils.getConnectTime(mCtx);
        PreferenceUtils.setRequestId(mCtx, requestId);
        Request compressedRequest = originalRequest.newBuilder()
            .url(url)
            .build();
        return chain.proceed(compressedRequest);
    }
}

@swankjesse
Copy link
Member

Any pattern in the devices or OS versions impacted?

@broakenmedia
Copy link

They're both Samsung 4.1.2 but i believe that's simply just because it's the only device the client is testing with.

@swankjesse
Copy link
Member

Try to reproduce on another device? We've seen device-specific JIT compiler bugs before, and this looks like one of those.

@dave-r12
Copy link
Collaborator

dave-r12 commented Mar 1, 2016

@xbroak are you calling createService more than once? If I'm reading that code right, you're adding the same interceptor for each call to createService to a single instance of OkHttpClient. Said differently, if you call createService N times, you'll end up with N interceptors.

@swankjesse
Copy link
Member

Looks like it's a problem of adding the same interceptor multiple times. This can't happen with OkHttp 3. No action for us to take here.

@broakenmedia
Copy link

broakenmedia commented Apr 15, 2016

It wasn't anything to do with me adding the interceptor multiple times. Just FYI. But i just removed the interceptor altogether such that this is no longer an issue for me any more, so feel free to keep it closed.

@swankjesse
Copy link
Member

@xbroak strange. If it happens again I'm sure we'll find out about it. I couldn't manage to reproduce last time I tried.

@chrisstewart
Copy link

I ran into this problem as well. It was a case of adding an interceptor multiple times. I am using OkHttp3 however, which based on @swankjesse's comment shouldn't have been possible. I ended up clearing the interceptors before adding it again.

@and0202
Copy link

and0202 commented Jul 14, 2016

I get this error。

`
public class ServiceGenerator {
public static final String API_BASE_URL = GlobalUtil.ROOTURL;
public static String token = "";
private static OkHttpClient.Builder httpClient = new OkHttpClient.Builder();

public static TokenInterceptor interceptor =null;

private static Retrofit.Builder builder = new Retrofit.Builder().baseUrl(API_BASE_URL)
        .addConverterFactory(GsonConverterFactory.create());


public static <S> S createService(final Context context, Class<S> serviceClass) {
    if (interceptor == null || !StringUtil.isUseable(token)){
        interceptor = new TokenInterceptor(context);
    }

    httpClient.interceptors().add(interceptor);
    Retrofit retrofit = builder.client(httpClient.build()).build();
    return retrofit.create(serviceClass);
}

public static Retrofit getRetrofit() {
    Retrofit retrofit = builder.client(httpClient.build()).build();
    return retrofit;
}

}

public class TokenInterceptor implements Interceptor{
private Context context;
public TokenInterceptor(Context context) {
LogUtil.d("TokenInterceptor create");
this.context = context;
}

@Override
public Response intercept(Chain chain) throws IOException {
    LogUtil.d("TokenInterceptor intercept");

    Request origina1 = chain.request();
    Request request = null;
    try {
        if (!StringUtil.isUseable(ServiceGenerator.token)){
            ServiceGenerator.token = AuthLoginDao.authLoginQuery(context).access_token;
        }

        if (ServiceGenerator.token != null && !ServiceGenerator.token.equals("null") && !ServiceGenerator.token.equals("")) {
            request = origina1.newBuilder().header("x-auth-token", ServiceGenerator.token).build();
        } else {
            request = origina1.newBuilder().build();
        }

    } catch (Exception e) {
        e.printStackTrace();
        request = origina1.newBuilder().build();
    }
    return chain.proceed(request);
}

}

`

@XiaomeiZeng
Copy link

XiaomeiZeng commented Aug 4, 2016

I have similar problem.
I use retrofit2 (OKHTTP3). In the App I create a background service to poll data from server every 10 seconds. After running for a while, I get the following error.

Note: the error looks different every time.

Decencies:
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'

The code (Kotlin):
private val httpClient = OkHttpClient.Builder() fun <S> createService(serviceClass: Class<S>, username: String?, password: String?): S? { val credential = Credentials.basic(username, password) val interceptor = Interceptor { chain -> val original = chain.request() val requestBuilder = original.newBuilder() .header("Authorization", credential) .header("Accept", "application/json") .header("Content-Type", "application/json") .method(original.method(), original.body()) val request = requestBuilder.build() chain.proceed(request) } httpClient.addInterceptor(interceptor) val retrofit = Retrofit.Builder().baseUrl(IEventConstant.baseUrl).addConverterFactory(GsonConverterFactory.create()).client(httpClient.build()).build() return retrofit.create(serviceClass) }
Error example 1:
FATAL EXCEPTION: OkHttp Dispatcher
java.lang.StackOverflowError
at java.lang.IntegralToString$1.initialValue(IntegralToString.java:46)
at java.lang.ThreadLocal$Values.getAfterMiss(ThreadLocal.java:430)
at java.lang.ThreadLocal.get(ThreadLocal.java:65)
at java.lang.IntegralToString.convertInt(IntegralToString.java:216)
at java.lang.IntegralToString.appendInt(IntegralToString.java:173)
at java.lang.StringBuilder.append(StringBuilder.java:139)
at libcore.io.IoBridge.connectDetail(IoBridge.java:169)
at libcore.io.IoBridge.connect(IoBridge.java:114)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)
at java.net.Socket.connect(Socket.java:872)
at okhttp3.internal.platform.AndroidPlatform.connectSocket(AndroidPlatform.java:61)
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:187)
at okhttp3.internal.connection.RealConnection.buildConnection(RealConnection.java:173)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:114)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:193)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)

Error example 2:
FATAL EXCEPTION: OkHttp Dispatcher
Process: clearfield.com.ievent, PID: 9186
java.lang.StackOverflowError: stack size 1037KB
at java.lang.reflect.Method.invoke(Native Method)
at okhttp3.internal.platform.AndroidPlatform.isCleartextTrafficPermitted(AndroidPlatform.java:139)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:102)
at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:193)
at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:129)
at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:98)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)

@XiaomeiZeng
Copy link

XiaomeiZeng commented Aug 4, 2016

Looks like the error I reported above can be fixed by clearing interceptors every time (thanks for chrisstewart comments above). I have run the following code more than one hour and there is no StackOverflowError any more.

Add code (Kotlin): httpClient.interceptors().clear()

The the code as following:
`
private val httpClient = OkHttpClient.Builder()
fun createService(serviceClass: Class, username: String?, password: String?): S? {

///////////////////////////new code
if (httpClient.interceptors().isNotEmpty()) {
httpClient.interceptors().clear()
}
////////////////////////////////new code

val credential = Credentials.basic(username, password)
val interceptor = Interceptor { chain ->
val original = chain.request()
val requestBuilder = original.newBuilder()
.header("Authorization", credential)
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.method(original.method(), original.body())
val request = requestBuilder.build()
chain.proceed(request)
}
httpClient.addInterceptor(interceptor)
val retrofit = Retrofit.Builder().baseUrl(IEventConstant.baseUrl).addConverterFactory(GsonConverterFactory.create()).client(httpClient.build()).build()

return retrofit.create(serviceClass)
}
`

@gold-duo
Copy link

gold-duo commented May 15, 2018

The same exception.
After setting up the Retryonconnectionfailure true and add a custom interceptor.
device: android kitkat

@scsfwgy
Copy link

scsfwgy commented Jun 21, 2018

The same error can be sometimes cash!--->> implementation 'com.squareup.okhttp3:okhttp:3.9.1'

@scsfwgy
Copy link

scsfwgy commented Jun 21, 2018

@XiaomeiZeng The solution of clearing interceptors maybe create a lot of repetitive same interceptors....,can be same better solution? @swankjesse

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

10 participants