lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colvin Cowie <>
Subject ContentStreamUpdateRequest no longer closes stream
Date Mon, 10 Jun 2019 12:17:59 GMT
Hello, I'm in the process of moving from Solr 6. to Solr 8.
We have a client application that streams CSV files to Solr using
ContentStreamUpdateRequest and then deletes the CSV file once the data is
indexed. That worked fine in Solr 6, but when using 8, the file is locked
and can't be deleted. (This is on Windows)

This seems to be because of the changes made in

*@Override  public RequestWriter.ContentWriter getContentWriter(String
expectedType) {    if (contentStreams == null || contentStreams.isEmpty()
|| contentStreams.size() > 1) return null;    ContentStream stream =
contentStreams.get(0);    return new RequestWriter.ContentWriter() {
@Override      public void write(OutputStream os) throws IOException {
  IOUtils.copy(stream.getStream(), os);      }      @Override      public
String getContentType() {        return stream.getContentType();      }
};  }*
As far as I know, IOUtils.copy will not close the stream.

Adding a close to it, is enough to "fix" it for me

*         try {            IOUtils.copy(innerStream, os);          }
finally {            IOUtils.closeQuietly(innerStream);          }*

I've attached a simple test case. It passes with the change above and fails
without it.

So, is this a bug, or is there something I'm supposed to be doing elsewhere
to close the stream?


  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message