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

IllegalStateException: released #2198

Closed
Wavesonics opened this issue Jan 4, 2016 · 5 comments
Closed

IllegalStateException: released #2198

Wavesonics opened this issue Jan 4, 2016 · 5 comments
Labels
bug Bug in existing code
Milestone

Comments

@Wavesonics
Copy link

java.lang.IllegalStateException: released

I'm getting this sporadically during long monkey test runs, we do lots of connection cancellation during these runs, so could be related to that maybe? Any insight into what might lead to this? The stack is entirely inside OkHttp code so not much to go on here.

// java.lang.IllegalStateException: released // at com.squareup.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:142) // at com.squareup.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126) // at com.squareup.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95) // at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:283) // at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224) // at com.squareup.okhttp.Call.getResponse(Call.java:286) // at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243) // at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205) // at com.squareup.okhttp.Call.access$100(Call.java:35) // at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:171) // at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33) // at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) // at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) // at java.lang.Thread.run(Thread.java:856)

@swankjesse
Copy link
Member

Definitely a bug in OkHttp, but nothing I could spot within a few minutes of staring at the code. I’ll try to reproduce and get this fixed.

@swankjesse swankjesse added the bug Bug in existing code label Jan 5, 2016
@swankjesse swankjesse added this to the 3.0 milestone Jan 5, 2016
@dave-r12
Copy link
Collaborator

dave-r12 commented Jan 6, 2016

This may or may not be related, I get the IllegalStateException with this scenario. I'm not 100% sure if this is considered valid

  @Test public void cachedRedirect() throws IOException {
    server.enqueue(new MockResponse()
        .setResponseCode(HttpURLConnection.HTTP_MOVED_PERM)
        .addHeader("Cache-Control: max-age=60")
        .addHeader("Location: /bar"));
    server.enqueue(new MockResponse()
        .setBody("ABC"));
    server.enqueue(new MockResponse()
        .setBody("ABC"));

    Request request1 = new Request.Builder().url(server.url("/foo")).build();
    Response response1 = client.newCall(request1).execute();
    assertEquals("ABC", response1.body().string());

    Request request2 = new Request.Builder().url(server.url("/foo")).build();
    Response response2 = client.newCall(request2).execute();
    assertEquals("ABC", response2.body().string());
  }

@swankjesse
Copy link
Member

@dave-r12 ooh, awesome test. Thankyou

swankjesse added a commit that referenced this issue Jan 7, 2016
We might still need them to handle a redirect.

Closes: #2198
@Wavesonics
Copy link
Author

Is there any plan to release another bug fix to the 2.x branch or will this only be in 3.0?

@swankjesse
Copy link
Member

Can do. #2209

swankjesse added a commit that referenced this issue Jan 8, 2016
We might still need them to handle a redirect.

Closes: #2198
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in existing code
Projects
None yet
Development

No branches or pull requests

3 participants