[
https://issues.apache.org/jira/browse/LUCENE-4245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Uwe Schindler updated LUCENE-4245:
----------------------------------
Attachment: LUCENE-4245.patch
Patch that preserves Thread interrupt status and handles thread interrupts in
non-interruptible methods according to Sun/Oracle handbook.
This problem exists in more places at Lucene also test failures caused by this.
There is a reason why InterruptedException is *checked*. We convert it to
unchecked by wrapping with ThreadInterruptedException. But thats the wrong way
to do. InterruptedException is checked, because on interrupting such a method
that explicitely declares InterruptedException, you have to take care,
otherwoise you hide interrupts. Simon already has a patch to cleanup (not yet
committed, also addressing this issue).
If you have a methods that is defined to not be interruptible, like
Closeable#close() [interface dictates!], you are not allowe d to interrupt. The
correct way to handle this is to save interrupt status on entering method, then
call the interruptible things like wait(), join() but repeat them on a new
interrupt (so make then non-interruptible). And finally reset the interrupt
status to the previous one including new interrupts (see examples in patch).
If we would not have hidden the InterruptedException in IndexWriter's close() -
he issue we have here would not be there.
One example also violating the close()-not-interruptible is e.g.
NRTManagerReopenThread. If you call close() and interrupt that, the thread
leaks because it no longer waits for it to finish. We have similar leaks in
TestDocumentsWriterStallControl. This should be fixed by nuking the
RuntimeExSubclass and handle all interrupts correctly (it's easy, you have to
know how).
I will open issue once this issue is solved.
> IndexWriter#close(true) should either not be interruptible or should abort
> background merge threads before returning
> --------------------------------------------------------------------------------------------------------------------
>
> Key: LUCENE-4245
> URL: https://issues.apache.org/jira/browse/LUCENE-4245
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/index
> Reporter: Mark Miller
> Assignee: Uwe Schindler
> Priority: Minor
> Attachments: LUCENE-4245.patch, LUCENE-4245.patch, LUCENE-4245.patch,
> LUCENE-4245.patch, LUCENE-4245.patch
>
>
> Currently, there is no safe way to close a directory after closing the writer
> without causing an exception in a merge thread if the #close call is
> interrupted.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]