apache / apache/lucene

If IndexWriter is interrupted on close and is using a channel (mmap/nio), it can throw a ClosedByInterruptException and prevent you from opening a new IndexWriter in the same proceses if you are using Native locks. [LUCENE-4638]

Open
#5,703 17 comments 0 reactions 0 assignees View on GitHub
legacy-jira-fix-version:4.9 legacy-jira-fix-version:6.0 legacy-jira-priority:Major type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

The ClosedByInterruptException will prevent the index from being unlocked in close. If you try and close again, the call will hang. If you are using native locks and try to open a new IndexWriter, it will fail to get the lock. If you try IW#forceUnlock, it wont work because the not fully closed IW will still have the lock.

ideas:
- On ClosedByInterruptException, IW should continue trying to close what it can and unlock the index? Generally I have see the exception trigger in commitInternal.
- We should add a non static forceUnlock to IW that lets you remove the lock and start a new IW?
- We should make the lock protected so IW sub classes could unlock the index in advanced use cases?
- others?

---
Migrated from [LUCENE-4638](https://issues.apache.org/jira/browse/LUCENE-4638) by Mark Miller (@markrmiller), 2 votes, updated May 09 2016
Attachments: [LUCENE-4638.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-4638/LUCENE-4638.patch)
Linked issues:
- #5316

Contributor guide

Open the contributing guide

Research direction

Start with IndexWriter.close and the commitInternal path mentioned in the report, then review the attached LUCENE-4638.patch and the linked issue #5316. Determine how an interrupted close should release the index lock and what behavior should be covered before considering the issue done.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, search
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.