[ 
https://issues.apache.org/jira/browse/HTTPCORE-577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16843391#comment-16843391
 ] 

Oleg Kalnichevski commented on HTTPCORE-577:
--------------------------------------------

[~cleverfoo] 

1. The culprit is this line in your message exchange handler that causes a NPE.
{code:java}
requestMessage.getBody().close();
{code}
GET messages issued by the benchmark enclose no request entity
{noformat}
GET / HTTP/1.0
Connection: Keep-Alive
Host: localhost:8080
User-Agent: ApacheBench/2.3
Accept: */*

{noformat}
Therefore {{requestMessage#getBody}} return null and the code above causes an 
NPE.

2. The response producer supplied by the exchange handler does not actually do 
much in case of an exception, so exceptions get easily overlooked.  At the very 
least the response handler should log or print the exception.

{code:java}
responseTrigger.submitResponse(new BasicResponseProducer(resp) {

    @Override
    public void failed(Exception cause) {
        cause.printStackTrace();
    }

}, context);
{code}

3. On top of everything there was a bug in the server side HTTP protocol 
negotiator causing the handler failure to propagate exceptions to the i/o event 
handler associated with the i/o session. I'll commit the fix to the master 
shortly.

https://github.com/apache/httpcomponents-core/commit/6bd4bdb8eeabe1458e0029fe9cb0ab61fddc86c5

Oleg


> Random connection resets under load
> -----------------------------------
>
>                 Key: HTTPCORE-577
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-577
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore NIO
>    Affects Versions: 5.0-beta7
>         Environment: openjdk 11.0.2 2019-01-15
> OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.2+9)
> OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.2+9, mixed mode, sharing)
> macOS
>            Reporter: Rafael Ferreira
>            Priority: Major
>
> It appears that under load a hc5 server will send an unexpected connection 
> reset to the client, here's a sample code that triggers the issue: 
> [https://github.com/rferreira/hc5]
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to