You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Lukas O'Daniel (Jira)" <ji...@apache.org> on 2020/08/19 22:47:00 UTC

[jira] [Updated] (HTTPCORE-647) Connection aborted infinite loop

     [ https://issues.apache.org/jira/browse/HTTPCORE-647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukas O'Daniel updated HTTPCORE-647:
------------------------------------
    Description: 
There is some issue that occurs when a response is not fully written and the connection closes or times out in 4.4.13. When this occurs, there is some infinite loop that logs the stack trace multiple times per millisecond. I have attached a simple example that can reproduce this behavior. The entity I'm using is based on NByteArrayEntity. In practice this issue was extremely rare on our servers, but requires restart to fix.

 

This can be reproduced by running [^Server.java] and then running [^Client.java]

 

For localhost I get the error and stack trace dumped infinitely:
 {{java.io.IOException: An established connection was aborted by the software in your host machinejava.io.IOException: An established connection was aborted by the software in your host machine at sun.nio.ch.SocketDispatcher.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:65) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) at org.apache.http.impl.nio.reactor.SessionOutputBufferImpl.flush(SessionOutputBufferImpl.java:182) at org.apache.http.impl.nio.DefaultNHttpServerConnection.produceOutput(DefaultNHttpServerConnection.java:316) at org.apache.http.impl.nio.DefaultHttpServerIODispatch.onOutputReady(DefaultHttpServerIODispatch.java:248) at org.apache.http.impl.nio.DefaultHttpServerIODispatch.onOutputReady(DefaultHttpServerIODispatch.java:57) at org.apache.http.impl.nio.reactor.AbstractIODispatch.outputReady(AbstractIODispatch.java:145) at org.apache.http.impl.nio.reactor.BaseIOReactor.writable(BaseIOReactor.java:187) at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:341) at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591) at java.lang.Thread.run(Thread.java:748)}}

 

I was getting the equivalent on remote hosts with different error message:
 \{{ java.io.IOException: An existing connection was forcibly closed by the remote host}}

 

Apologies for formatting, etc this is my first open source bug report. 

This seems like it could be related to the fix for HTTPCORE-607. I don't get this issue, at least for this example code, using 4.4.12 and previous.
  

  was:
There is some issue that occurs when a response is not fully written and the connection closes or times out in 4.4.13. When this occurs, there is some infinite loop that logs the stack trace multiple times per millisecond. I have attached a simple example that can reproduce this behavior. The entity I'm using is based on NByteArrayEntity. In practice this issue was extremely rare on our servers, but requires restart to fix.

 

This can be reproduced by running [^Server.java] and then running [^Client.java]

 

For localhost I get the error and stack trace dumped infinitely:
{{java.io.IOException: An established connection was aborted by the software in your host machinejava.io.IOException: An established connection was aborted by the software in your host machine at sun.nio.ch.SocketDispatcher.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:65) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) at org.apache.http.impl.nio.reactor.SessionOutputBufferImpl.flush(SessionOutputBufferImpl.java:182) at org.apache.http.impl.nio.DefaultNHttpServerConnection.produceOutput(DefaultNHttpServerConnection.java:316) at org.apache.http.impl.nio.DefaultHttpServerIODispatch.onOutputReady(DefaultHttpServerIODispatch.java:248) at org.apache.http.impl.nio.DefaultHttpServerIODispatch.onOutputReady(DefaultHttpServerIODispatch.java:57) at org.apache.http.impl.nio.reactor.AbstractIODispatch.outputReady(AbstractIODispatch.java:145) at org.apache.http.impl.nio.reactor.BaseIOReactor.writable(BaseIOReactor.java:187) at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:341) at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591) at java.lang.Thread.run(Thread.java:748)}}

 

I was getting the equivalent on remote hosts with different error message:
{{ java.io.IOException: An existing connection was forcibly closed by the remote host}}

 

Apologies for formatting, etc this is my first open source bug report. 
  


> Connection aborted infinite loop 
> ---------------------------------
>
>                 Key: HTTPCORE-647
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-647
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>    Affects Versions: 4.4.13
>         Environment: java 8
>            Reporter: Lukas O'Daniel
>            Priority: Major
>         Attachments: Client.java, Entity.java, Server.java
>
>
> There is some issue that occurs when a response is not fully written and the connection closes or times out in 4.4.13. When this occurs, there is some infinite loop that logs the stack trace multiple times per millisecond. I have attached a simple example that can reproduce this behavior. The entity I'm using is based on NByteArrayEntity. In practice this issue was extremely rare on our servers, but requires restart to fix.
>  
> This can be reproduced by running [^Server.java] and then running [^Client.java]
>  
> For localhost I get the error and stack trace dumped infinitely:
>  {{java.io.IOException: An established connection was aborted by the software in your host machinejava.io.IOException: An established connection was aborted by the software in your host machine at sun.nio.ch.SocketDispatcher.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:51) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) at sun.nio.ch.IOUtil.write(IOUtil.java:65) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) at org.apache.http.impl.nio.reactor.SessionOutputBufferImpl.flush(SessionOutputBufferImpl.java:182) at org.apache.http.impl.nio.DefaultNHttpServerConnection.produceOutput(DefaultNHttpServerConnection.java:316) at org.apache.http.impl.nio.DefaultHttpServerIODispatch.onOutputReady(DefaultHttpServerIODispatch.java:248) at org.apache.http.impl.nio.DefaultHttpServerIODispatch.onOutputReady(DefaultHttpServerIODispatch.java:57) at org.apache.http.impl.nio.reactor.AbstractIODispatch.outputReady(AbstractIODispatch.java:145) at org.apache.http.impl.nio.reactor.BaseIOReactor.writable(BaseIOReactor.java:187) at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:341) at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315) at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276) at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104) at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591) at java.lang.Thread.run(Thread.java:748)}}
>  
> I was getting the equivalent on remote hosts with different error message:
>  \{{ java.io.IOException: An existing connection was forcibly closed by the remote host}}
>  
> Apologies for formatting, etc this is my first open source bug report. 
> This seems like it could be related to the fix for HTTPCORE-607. I don't get this issue, at least for this example code, using 4.4.12 and previous.
>   



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org