-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
MockWebServer tests got stuck after updating from 3.9.1 to 3.10.0 #3898
Comments
Hmm. This is a little mystery. Can you attach a debugger and check out where OkHttp gets stuck? |
Everything is working fine until
readRequest(socket, source, sink, sequenceNumber) which also calls source.readUtf8LineStrict() which ends up calling RealBufferedSource#readUtf8LineStrict which finally throws a java.io.EOFException (\n not found: limit=0 content=… ) because apparently the size of the Buffer is 0 .Then the exception is bubble up to readRequest which returns null
processOneRequest returns false
processOneRequest loop and logs the WARNING: MockWebServer[59055] connection from /127.0.0.1 didn't make a request message because sequenceNumber is 0 .After that the test is still running (apparently waiting for new requests). It seems that there's an issue when getting the buffer from the socket and in
Let me know if you need any further information. |
Wanted to add that apart from the issue when trying to obtain the buffer from the socket, ☝️ seems like another problem because if at that point we've already received an error, why the test doesn't continue its execution and it gets stuck instead? It seems that in that scenario there are still resources opened. Does that make sense? |
Any chance you could isolate this into a standalone test case? All of OkHttp’s tests use OkHttp+MockWebServer and they’re all working fine. |
Mystery solved! Well partially... After a thoroughly debug session, @Sefford told me that when he bumped OkHttp version to .hostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
}) to the config of the Thanks @Sefford for pointing me in that direction 🙏 It seems that after #3764 changes if you're using MockWebServer with HTTPS you need to add ☝️ to your tests in order to have them ✅ After adding that config to my tests everything is working again 💃 But now I'm wondering why even when passing in an empty Let me know if it's worth it to open a new issue reporting ☝️ or if you prefer to keep the discussion here. |
There is still something worth digging into here regarding why the behaviour changed and why its hanging now. I'll try to take a look this week, but glad you have a workaround to unblock yourself. |
Awesome! Let me know if you have any questions or if you need further information/clarification. |
Any updates on this? Although I'm not sure if using |
SslClient is not public API and we might break you in a future release. |
SslClient public API: #3934 |
No action to take on this, other than to be afraid of how mocks + onFailure interact poorly. |
After updating from
3.9.1
to3.10.0
mockwebserver
tests got stuck.This is how I configure the
HttpClient
(I'm setting upHTTPS
and Certificate Pinning ) 👀3.9.1
👇3.10.0
👇Following you can find a failing test 👀
☝️ is using https://github.com/mapbox/mapbox-events-android code.
You can check that we only bumped OkHttp version to
3.10.0
👉 mapbox/mapbox-events-android@c92a4ac and after that tests got stuck.Tried many things without luck 😓
Any hints? What did it change that could affect tests in that sense?
The text was updated successfully, but these errors were encountered: