Mailing List Archive

WFST temporary file leftovers
Hi all,

Our project (https://github.com/oracle/opengrok/) is using
WFSTCompletionLookup to provide suggester functionality. Currently using
Lucene 8.6.2.

From time to time the temporary files generated by the WFST
implementation remain to be present in the file system after the build
completes (see https://github.com/oracle/opengrok/issues/2857).

Basically, one piece of our code (e.g.
https://github.com/oracle/opengrok/blob/cbbb3bf877d545962e35713d9061f82f7c643919/suggester/src/main/java/org/opengrok/suggest/SuggesterProjectData.java#L257)
goes like this:


WFSTCompletionLookup lookup = new WFSTCompletionLookup(tempDir,
WFST_TEMP_FILE_PREFIX);
lookup.build(iterator);
return lookup;


Looking into Lucene code, I can see that the
WFSTCompletionLookup#build() method utilizes WFSTInputIterator that is a
wrapper over SortedInputIterator that has private close() method which
actually removes the temporary files. The close() method is only called
from the from the next() iterator method. I wonder whether the code in
the iter.next() loop body inside the WFSTCompletionLookup#build() method
could be interrupted by an exception and cause the leftover temporary
files as a result. Perhaps WFSTInputIterator should be AutoCloseable and
propagate the call to the iterator ?

Thanks for any insights,


v.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org