Summary: | ERR_INCOMPLETE_CHUNKED_ENCODING errors when using NIO Connector with HTTPS | ||
---|---|---|---|
Product: | Tomcat 9 | Reporter: | justin.wong |
Component: | Util | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 9.0.20 | ||
Target Milestone: | ----- | ||
Hardware: | Macintosh | ||
OS: | All | ||
Attachments: | patch for NioEndpoint to use pool writes when blocking & non-blocking |
Description
justin.wong
2019-11-21 17:58:51 UTC
-1 for the patch, you're doing a blocking write, so it "works". We'll examine the issue eventually, but it most likely works fine as is. If it is non blocking, the "selector" was not doing any magic, it simply does a non blocking write, hence the patch. The previous code was using a write loop, that's the only difference I can see and you can try it. Such as: --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -1273,9 +1273,13 @@ // registered for write once as both container and user code can trigger // write registration. } else { - if (socket.write(from) == -1) { - throw new EOFException(); - } + int n = 0; + do { + n = socket.write(from); + if (n == -1) { + throw new EOFException(); + } + } while (n > 0 && from.hasRemaining()); } updateLastWrite(); } If you are still experiencing an issue, please provide a test case (there's an extensive non blocking write test in the Tomcat testsuite, which is not failing). Made that change, and don't have the problem anymore. Would adding that write loop back in be a possibility? Thanks, Justin Ok, sorry for the trouble, the loop seemed only useful for blocking mode so I didn't add it. The fix will be in Tomcat 9.0.30. Thanks for the fast turn around! |