jira-importer opened a new issue, #1010:
URL: https://github.com/apache/httpcomponents-core/issues/1010

   **[Miles 
Spielberg](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=mspielberg)**
 opened 
**[HTTPCORE-417](https://issues.apache.org/jira/browse/HTTPCORE-417?redirect=false)**
 and commented
   
   SSLIOSession.InternalByteChannel.write(ByteBuffer) does not obey the 
WriteableByteChannel contract. In writePlain(), if the channel is closed, -1 is 
returned, but WriteableByteChannel should throw ClosedChannelException in this 
case, and should certainly never return a negative value.
   
   This leads to an infinite loop in LengthDelimitedEncoder.write(). 
AbstractContentEncoder.writeToChannel() returns the -1 from 
SSLIOSession.InternalByteChannel, and this causes remaining to grow without 
bound 
(https://hc.apache.org/httpcomponents-core-4.4.x/httpcore-nio/xref/org/apache/http/impl/nio/codecs/LengthDelimitedEncoder.html#133).
   
   In my application, I see a stack trace similar to the following:
   
   ```
   I/O dispatcher 2 tid=199 [RUNNABLE]
   org.apache.http.nio.reactor.ssl.SSLIOSession.access$100(SSLIOSession, 
ByteBuffer) SSLIOSession.java:72
   
org.apache.http.nio.reactor.ssl.SSLIOSession$InternalByteChannel.write(ByteBuffer)
 SSLIOSession.java:811
   
org.apache.http.impl.nio.codecs.AbstractContentEncoder.doWriteChunk(ByteBuffer, 
boolean) AbstractContentEncoder.java:173
   
org.apache.http.impl.nio.codecs.AbstractContentEncoder.doWriteChunk(ByteBuffer, 
int, boolean) AbstractContentEncoder.java:166
   
org.apache.http.impl.nio.codecs.AbstractContentEncoder.writeToChannel(ByteBuffer,
 int) AbstractContentEncoder.java:140
   org.apache.http.impl.nio.codecs.LengthDelimitedEncoder.write(ByteBuffer) 
LengthDelimitedEncoder.java:132
   
com.box.http.apacheasync.compat.request.ActorSubscriberContentProducer$ContentProducer$.produceContent(ContentEncoder,
 IOControl) ActorSubscriberContentProducer.scala:114
   
com.box.http.apacheasync.compat.request.RequestConverter$$anon$1.produceContent(ContentEncoder,
 IOControl) RequestConverter.scala:78
   
org.apache.http.nio.protocol.BasicAsyncRequestProducer.produceContent(ContentEncoder,
 IOControl) BasicAsyncRequestProducer.java:125
   org.apache.http.impl.nio.client.MainClientExec.produceContent(InternalState, 
ContentEncoder, IOControl) MainClientExec.java:262
   
org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.produceContent(ContentEncoder,
 IOControl) DefaultClientExchangeHandlerImpl.java:136
   
org.apache.http.nio.protocol.HttpAsyncRequestExecutor.outputReady(NHttpClientConnection,
 ContentEncoder) HttpAsyncRequestExecutor.java:229
   
org.apache.http.impl.nio.DefaultNHttpClientConnection.produceOutput(NHttpClientEventHandler)
 DefaultNHttpClientConnection.java:292
   
org.apache.http.impl.nio.client.InternalIODispatch.onOutputReady(DefaultNHttpClientConnection)
 InternalIODispatch.java:86
   org.apache.http.impl.nio.client.InternalIODispatch.onOutputReady(Object) 
InternalIODispatch.java:39
   org.apache.http.impl.nio.reactor.AbstractIODispatch.outputReady(IOSession) 
AbstractIODispatch.java:154
   org.apache.http.impl.nio.reactor.BaseIOReactor.writable(SelectionKey) 
BaseIOReactor.java:190
   
org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(SelectionKey) 
AbstractIOReactor.java:343
   org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(Set) 
AbstractIOReactor.java:317
   org.apache.http.impl.nio.reactor.AbstractIOReactor.execute() 
AbstractIOReactor.java:278
   org.apache.http.impl.nio.reactor.BaseIOReactor.execute(IOEventDispatch) 
BaseIOReactor.java:106
   org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run() 
AbstractMultiworkerIOReactor.java:590
   java.lang.Thread.run() Thread.java:744
   ```
   
   
   
   ---
   
   **Affects:** 4.4.4
   
   **Backported to:** 
[4.4.5](https://github.com/apache/httpcomponents-core/milestone/42?closed=1)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to