[ https://issues.apache.org/jira/browse/HTTPCORE-718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17571461#comment-17571461 ]
Oleg Kalnichevski commented on HTTPCORE-718: -------------------------------------------- > In order to replicate the issue, we did a few changes to the > consumeContent(final ContentDecoder decoder) method inside the > SimpleInputBuffer class. [~sajiniekavindya] This is not a regression. The cause of the issue turned out to be the damn SimpleInputBuffer that you have tweaked. The problem is that the content decoder needs to be fully drained (consumed). Otherwise in some edge cases the decoder can end up in an incomplete state still waiting for more input while the opposite endpoint is done sending data causing the session stay open idle until a timeout. This is exactly what happens when the server sends a broken chunk with smaller chunk body than that announced in the chunk header and then closes the connection. With corrected SimpleInputBuffer works as expected. {noformat} Backend server started! Shutting down I/O reactor https://localhost:7005->org.apache.http.TruncatedChunkException: Truncated chunk (expected size: 5,136; actual size: 1,414) Done Shutdown Shutting down the backend server {noformat} Please kindly _*stop*_ wasting my vacation time. Oleg > Getting org.apache.http.ConnectionClosedException after httpcore-nio version > upgrade > ------------------------------------------------------------------------------------ > > Key: HTTPCORE-718 > URL: https://issues.apache.org/jira/browse/HTTPCORE-718 > Project: HttpComponents HttpCore > Issue Type: Bug > Components: HttpCore NIO > Affects Versions: 4.4.15 > Environment: Java version: 11.0.15.1 > OS: macOS Monterey (Version 12.12.1) > Reporter: Sajinie Kavindya > Priority: Major > Attachments: HttpNIOTestClient-1.zip, HttpNIOTestClient.zip > > > We recently migrated to httpcore-nio 4.4.15 and we have been encountering > some issues when connecting to an HTTPS Backend that sends chunked responses. > The backend behaves in such a manner that when it sends the response, it > immediately closes the connection after completion. > We have attached a reproducer to this ticket and the behavior is as below. > When httpcore-nio 4.4.15 is used, the client gets the error: > {code:java} > org.apache.http.ConnectionClosedException: Connection closed > unexpectedly{code} > But, when httpcore-nio 4.4.5 is used, the client receives the complete > response, which was sent from the backend. > We further checked on the following versions and the observations are as > below. > * httpcore-nio 4.4.10 - receives the complete response > * httpcore-nio 4.4.11 - receives org.apache.http.ConnectionClosedException > In order to replicate the issue, we did a few changes to the > consumeContent(final ContentDecoder decoder) method inside the > SimpleInputBuffer class. You may find the changes in the attached source code. > In order to test the behavior, please run the Main class: > “{*}TestChunkedBackend{*}”. > Tested environment: > * Java version: 11.0.15.1 > * OS: macOS Monterey (Version 12.12.1) > A similar issue can be found here > [https://issues.apache.org/jira/browse/HTTPCORE-706|http://example.com] > Thanks & Regards, > Sajinie > -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org