question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression in Exchange in 3.14

See original GitHub issue

Hey, folks - I think I’m running into something that appears to be a regression in 3.14 around the new exchange mechanism. I can reproduce this 100% of the time in my app by creating a specific scenario.

Here’s the basic setup. We have an interceptor that does a lot of things for us, including setting headers and handling retries for auth errors. Here’s a simplified version of the code, eliding a lot of details around how the retries are triggered:

@Override
public Response intercept(Chain chain) throws IOException {
  Request originalRequest = chain.request();
  Request.Builder builder = originalRequest.newBuilder();
  // Add headers/etc here.
  Request request = builder.build();
  Response response = chain.proceed(request);

  if (isError(response)) {
    // Grab a new auth token, etc.
    response = chain.proceed(retry);
    return response;
  }
}

In 3.13.1, this seems to work just fine. In 3.14.0, this crashes with the following error:

03-22 11:52:21.889 E/AndroidRuntime(10135): java.lang.IllegalStateException: exchange != null
03-22 11:52:21.889 E/AndroidRuntime(10135): 	at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:159)
03-22 11:52:21.889 E/AndroidRuntime(10135): 	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
...

It doesn’t seem to matter if you mutate the request or not. Even just using (as above) a newly built version of the request produces the same behavior.

Any ideas what’s happening here? I’m going to revert our library back to 3.13 for now to work around this, but I’m curious what could be causing this.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
tmtrademarkedcommented, Mar 28, 2019

Yup, looks like the same bug - I’d bet that if you add origResponse.close() before the val newResponse line in the auth interceptor, the problem will disappear. 😃

1reaction
swankjessecommented, Mar 22, 2019

Yeah, my assumption is that previously you would have had two response bodies open concurrently for a single call.

We should fix the exception to be more obvious about what the problem is.

Read more comments on GitHub >

github_iconTop Results From Across the Web

1 Regression results for equation [3.14a]. | Download Table
This paper focuses on CEE countries volatility captured by exchange rate dynamic. The spillover phenomenon is analyzed from the perspective of the actual ......
Read more >
why does linear regression give a good result here?
I was trying to show that the creation of a new variable, the product of height, width, and length, should improve the regression...
Read more >
Exchange Rates and Fundamentals: Evidence on Long ... - jstor
Regressions of multiple-period changes in the log exchange rate on the deviation ... For the last rows in the table, Pi and pu...
Read more >
Homework_3_Answers_updated.docx - USC Dornsife
According to the regression line, the higher inflation in the US relative to Canada, higher the exchange rate of CD to $. Higher...
Read more >
Exchange Rates and Fundamentals: Evidence on Long ...
Regressions of multiple-period changes in the log exchange rate on the deviation of the log exchange rate from its "fundamental value," display evidence ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found