You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Thomas Hoffmann (Jira)" <ji...@apache.org> on 2022/05/19 13:08:00 UTC

[jira] [Comment Edited] (LUCENE-3373) waitForMerges deadlocks if background merge fails

    [ https://issues.apache.org/jira/browse/LUCENE-3373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17539536#comment-17539536 ] 

Thomas Hoffmann edited comment on LUCENE-3373 at 5/19/22 1:07 PM:
------------------------------------------------------------------

I think I encountered the same behaviour with version 8.11.1:

"https-openssl-nio-443-exec-30" #166 daemon prio=5 os_prio=0 cpu=78703.13ms elapsed=81248.18s tid=0x000000002860af10 nid=0x237c in Object.wait()  [0x00000000413fc000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(java.base@17.0.2/Native Method)
 - waiting on <no object reference available>
at org.apache.lucene.index.IndexWriter.doWait(IndexWriter.java:4983)
 - locked <0x00000006ef1fc020> (a org.apache.lucene.index.IndexWriter)
at org.apache.lucene.index.IndexWriter.waitForMerges(IndexWriter.java:2697)
 - locked <0x00000006ef1fc020> (a org.apache.lucene.index.IndexWriter)
at org.apache.lucene.index.IndexWriter.shutdown(IndexWriter.java:1236)
at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:1278)
at com.xxx.module.search.SearchService.updateSearchIndex(SearchService.java:1723)
 - locked <0x00000006d5c00208> (a org.apache.lucene.store.MMapDirectory)
at com.xxx.module.businessrelations.ticket.TicketChangedListener.postUpdate(TicketChangedListener.java:142)

The call never returned and caused the application to hook.

OS: Windows 2019


was (Author: tom_s4t):
I think I encountered the same behaviour with version 8.11.1:

"https-openssl-nio-443-exec-30" #166 daemon prio=5 os_prio=0 cpu=78703.13ms elapsed=81248.18s tid=0x000000002860af10 nid=0x237c in Object.wait()  [0x00000000413fc000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(java.base@17.0.2/Native Method)
- waiting on <no object reference available>
at org.apache.lucene.index.IndexWriter.doWait(IndexWriter.java:4983)
- locked <0x00000006ef1fc020> (a org.apache.lucene.index.IndexWriter)
at org.apache.lucene.index.IndexWriter.waitForMerges(IndexWriter.java:2697)
- locked <0x00000006ef1fc020> (a org.apache.lucene.index.IndexWriter)
at org.apache.lucene.index.IndexWriter.shutdown(IndexWriter.java:1236)
at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:1278)
at com.xxx.module.search.SearchService.updateSearchIndex(SearchService.java:1723)
- locked <0x00000006d5c00208> (a org.apache.lucene.store.MMapDirectory)
at com.xxx.module.businessrelations.ticket.TicketChangedListener.postUpdate(TicketChangedListener.java:142)

The call never returned and caused the application to hook.

> waitForMerges deadlocks if background merge fails
> -------------------------------------------------
>
>                 Key: LUCENE-3373
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3373
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 3.0.3
>            Reporter: Tim Smith
>            Priority: Major
>
> waitForMerges can deadlock if a merge fails for ConcurrentMergeScheduler
> this is because the merge thread will die, but pending merges are still available
> normally, the merge thread will pick up the next merge once it finishes the previous merge, but in the event of a merge exception, the pending work is not resumed, but waitForMerges won't complete until all pending work is complete
> i worked around this by overriding doMerge() like so:
> {code}
>   protected final void doMerge(MergePolicy.OneMerge merge) throws IOException {
>     try {
>       super.doMerge(merge);
>     } catch (Throwable exc) {
>       // Just logging the exception and not rethrowing
>       // insert logging code here
>     }
>   }
> {code}
> Here's the rough steps i used to reproduce this issue:
> override doMerge like so
> {code}
>   protected final void doMerge(MergePolicy.OneMerge merge) throws IOException {
>     try {Thread.sleep(500L);} catch (InterruptedException e) { }
>     super.doMerge(merge);
>     throw new IOException("fail");
>   }
> {code}
> then, if you do the following:
> loop 50 times:
>   addDocument // any doc
>   commit
> waitForMerges // This will deadlock sometimes
> SOLR-2017 may be related to this (stack trace for deadlock looked related)



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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