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

Joel Bernstein commented on SOLR-10698:
---------------------------------------

Update on this ticket. It turned out the problem had nothing to do with jetty. 
The issue is that the HttpClient continues to consume the stream even after the 
inputstream from the httpclient has been closed. [~varunthacker], noticed the 
odd looking *read* following the *close* in the stack trace. This is the 
ChunkedInputStream close behavior, which is to consume the entire stream when 
close is called.

I'll post a patch shortly that closes the HttpResponse rather then the 
inputstream. The patch also catches all exceptions that occur while writing to 
the client and closes the underlying tuple stream. 

The effect of these two changes should be that when the client closes a 
TupleStream:

1) The server writing the tuples will get a broken pipe exception and close 
it's underlying TupleStream.
2) This will cause a chain reaction of broken pipes and stream closings that 
will eventually shut down all streams and stop the /export handler with a 
broken pipe exception.

This patch has not yet been tested.




> StreamHandler should allow connections to be closed early 
> ----------------------------------------------------------
>
>                 Key: SOLR-10698
>                 URL: https://issues.apache.org/jira/browse/SOLR-10698
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Varun Thacker
>
> Before a stream is drained out, if we call close() we get an exception like 
> this:
> {code}
> at
> org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:215)
> at
> org.apache.http.impl.io.ChunkedInputStream.close(ChunkedInputStream.java:316)
> at
> org.apache.http.impl.execchain.ResponseEntityProxy.streamClosed(ResponseEntityProxy.java:128)
> at
> org.apache.http.conn.EofSensorInputStream.checkClose(EofSensorInputStream.java:228)
> at
> org.apache.http.conn.EofSensorInputStream.close(EofSensorInputStream.java:174)
> at sun.nio.cs.StreamDecoder.implClose(StreamDecoder.java:378)
> at sun.nio.cs.StreamDecoder.close(StreamDecoder.java:193)
> at java.io.InputStreamReader.close(InputStreamReader.java:199)
> at
> org.apache.solr.client.solrj.io.stream.JSONTupleStream.close(JSONTupleStream.java:91)
> at
> org.apache.solr.client.solrj.io.stream.SolrStream.close(SolrStream.java:186)
> {code}
> As quoted from 
> https://www.mail-archive.com/[email protected]/msg130676.html the 
> problem seems to when we hit an exception the /steam handler does not close 
> the stream.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to