Buggy code:
public class SolrIndexSplitter { public static Logger log = LoggerFactory . getLogger ( SolrIndexSplitter . class ) ; SolrIndexSearcher searcher ; SchemaField field ; List < DocRouter . Range > ranges ; Range [ ] rangesArr ; List < String > paths ; List < SolrCore > cores ; DocRouter router ; HashBasedRouter hashRouter ; int numPieces ; int currPartition = 0 ; String routeFieldName ; String splitKey ; public SolrIndexSplitter ( SplitIndexCommand cmd ) { } public void split ( ) throws IOException { List < AtomicReaderContext > leaves = searcher . getTopReaderContext ( ) . leaves ( ) ; List < FixedBitSet [ ] > segmentDocSets = new java . util . ArrayList ( leaves . size ( ) ) ; SolrIndexSplitter . log . info ( ( ( ( "SolrIndexSplitter:<seq2seq4repair_space>partitions=" + ( numPieces ) ) + "<seq2seq4repair_space>segments=" ) + ( leaves . size ( ) ) ) ) ; for ( AtomicReaderContext readerContext : leaves ) { assert ( readerContext . ordInParent ) == ( segmentDocSets . size ( ) ) ; FixedBitSet [ ] docSets = split ( readerContext ) ; segmentDocSets . add ( docSets ) ; } for ( int partitionNumber = 0 ; partitionNumber < ( numPieces ) ; partitionNumber ++ ) { SolrIndexSplitter . log . info ( ( ( ( ( "SolrIndexSplitter:<seq2seq4repair_space>partition<seq2seq4repair_space>#" + partitionNumber ) + "<seq2seq4repair_space>partitionCount=" ) + ( numPieces ) ) + ( ( ranges ) != null ? "<seq2seq4repair_space>range=" + ( ranges . get ( partitionNumber ) ) : "" ) ) ) ; boolean success = false ; RefCounted < IndexWriter > iwRef = null ; IndexWriter iw = null ; if ( ( cores ) != null ) { SolrCore subCore = cores . get ( partitionNumber ) ; iwRef = subCore . getUpdateHandler ( ) . getSolrCoreState ( ) . getIndexWriter ( subCore ) ; iw = iwRef . get ( ) ; } else { SolrCore core = searcher . getCore ( ) ; String path = paths . get ( partitionNumber ) ; iw = SolrIndexWriter . create ( ( ( "SplittingIndexWriter" + partitionNumber ) + ( ( ranges ) != null ? "<seq2seq4repair_space>" + ( ranges . get ( partitionNumber ) ) : "" ) ) , path , core . getDirectoryFactory ( ) , true , core . getLatestSchema ( ) , core . getSolrConfig ( ) . indexConfig , core . getDeletionPolicy ( ) , core . getCodec ( ) ) ; } try { for ( int segmentNumber = 0 ; segmentNumber < ( leaves . size ( ) ) ; segmentNumber ++ ) { SolrIndexSplitter . log . info ( ( ( ( ( ( ( ( ( "SolrIndexSplitter:<seq2seq4repair_space>partition<seq2seq4repair_space>#" + partitionNumber ) + "<seq2seq4repair_space>partitionCount=" ) + ( numPieces ) ) + ( ( ranges ) != null ? "<seq2seq4repair_space>range=" + ( ranges . get ( partitionNumber ) ) : "" ) ) + "<seq2seq4repair_space>segment<seq2seq4repair_space>#" ) + segmentNumber ) + "<seq2seq4repair_space>segmentCount=" ) + ( leaves . size ( ) ) ) ) ; IndexReader subReader = new SolrIndexSplitter . LiveDocsReader ( leaves . get ( segmentNumber ) , segmentDocSets . get ( segmentNumber ) [ partitionNumber ] ) ; iw . addIndexes ( subReader ) ; } success = true ; } finally { if ( iwRef != null ) { iwRef . decref ( ) ; } else { if ( success ) { <START_BUG> IOUtils . close ( iw ) ; <END_BUG> } else { IOUtils . closeWhileHandlingException ( iw ) ; } } } } } FixedBitSet [ ] split ( AtomicReaderContext readerContext ) throws IOException { } public static String getRouteKey ( String idString ) { } static class LiveDocsReader extends FilterAtomicReader { final FixedBitSet liveDocs ; final int numDocs ; public LiveDocsReader ( AtomicReaderContext context , FixedBitSet liveDocs ) throws IOException { } @ Override public int numDocs ( ) { } @ Override public Bits getLiveDocs ( ) { } } }

Fix:
iw . shutdown ( ) ;