-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
java.lang.IllegalStateException: Unbalanced enter/exit #7381
Comments
Yikes, yes this is definitely OkHttp's fault. Thanks for the careful test case, that'll make this easier to fix! |
Great; thanks for confirming. It's worth mentioning that, oddly this only seemed to catch us out when the process first starts (and the host we're attempting to connect to returns 503): Once a successful connection had been made, subsequent socket drop + recovery attempts resulting in 503 do not appear to trigger the same problem. I am not 100% on this though. |
I can't reproduce this, including with the test. Any chance you can put up a draft PR with a test showing failures in CI? I've even tried using an Interceptor to change the error to a 503, since the site you used no longer fails in that way. |
Also happening on my end with the exact stack trace and using websockets (wrapped with KTOR though). Basicallly when the websocket breaks down I immediately connect it again, causing the issue. |
…lated to this issue: square/okhttp#7381
I also just ran into this. @yschimke I've got a public repo for you: vanniktech/playground#96 which fails:
|
Any clue why is this hapenning? I'm getting the same issue. |
Nope. I'm also using the workaround stated above. Basically waiting a few milliseconds. |
I'll take a look at the repro on the weekend. Thanks for providing it. Apologies, but have been battling a different issue with media3 at the moment. |
Found the cause. @swankjesse can probably spot if the reordering is wrong, otherwise I'll try to land with a test this weekend. |
Apologies if this has already been addressed. I have encountered the following problem:
onFailure()
.onFailure()
:onFailure()
) or from a separate thread. Note that I am using a shared staticOkHttpClient
instance, as this was the recommended approach.Sample Code
I was able to reproduce the problem by providing a non-websocket URL that then returns a status code other than 101:
Any help would be greatly appreciated. Obviously I have the workaround but it would be good to understand if this is a genuine bug, whether I am mis-using the API, or whether the site in question is not following the correct protocol by returning something other than 101 during the initial handshake.
Thanks,
Adam.
The text was updated successfully, but these errors were encountered: