You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2008/03/04 11:16:40 UTC

[jira] Created: (LUCENE-1200) IndexWriter.addIndexes* can deadlock in rare cases

IndexWriter.addIndexes* can deadlock in rare cases
--------------------------------------------------

                 Key: LUCENE-1200
                 URL: https://issues.apache.org/jira/browse/LUCENE-1200
             Project: Lucene - Java
          Issue Type: Bug
          Components: Index
    Affects Versions: 2.4
            Reporter: Michael McCandless
            Assignee: Michael McCandless
            Priority: Minor
             Fix For: 2.4


In somewhat rare cases it's possible for addIndexes to deadlock
because it is a synchronized method.

Normally the merges that are necessary for addIndexes are done
serially (with the primary thread) because they involve segments from
an external directory.  However, if mergeFactor of these merges
complete then a merge becomes necessary for the merged segments, which
are not external, and so it can run in the background.  If too many BG
threads need to run (currently > 4) then the "pause primary thread"
approach adopted in LUCENE-1164 will deadlock, because the addIndexes
method is holding a lock on IndexWriter.

This was appearing as a intermittant deadlock in the
TestIndexWriterMerging test case.

This issue is not present in 2.3 (it was caused by LUCENE-1164).

The solution is to shrink the scope of synchronization: don't
synchronize on the whole method & wrap synchronized(this) in the right
places inside the methods.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-1200) IndexWriter.addIndexes* can deadlock in rare cases

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hoss Man updated LUCENE-1200:
-----------------------------

    Fix Version/s: 2.3.2

targeted for 2.3.2 bug fix release

> IndexWriter.addIndexes* can deadlock in rare cases
> --------------------------------------------------
>
>                 Key: LUCENE-1200
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1200
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.3.2, 2.4
>
>         Attachments: LUCENE-1200.patch
>
>
> In somewhat rare cases it's possible for addIndexes to deadlock
> because it is a synchronized method.
> Normally the merges that are necessary for addIndexes are done
> serially (with the primary thread) because they involve segments from
> an external directory.  However, if mergeFactor of these merges
> complete then a merge becomes necessary for the merged segments, which
> are not external, and so it can run in the background.  If too many BG
> threads need to run (currently > 4) then the "pause primary thread"
> approach adopted in LUCENE-1164 will deadlock, because the addIndexes
> method is holding a lock on IndexWriter.
> This was appearing as a intermittant deadlock in the
> TestIndexWriterMerging test case.
> This issue is not present in 2.3 (it was caused by LUCENE-1164).
> The solution is to shrink the scope of synchronization: don't
> synchronize on the whole method & wrap synchronized(this) in the right
> places inside the methods.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-1200) IndexWriter.addIndexes* can deadlock in rare cases

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-1200:
---------------------------------------

    Attachment: LUCENE-1200.patch

Attached patch.  I plan to commit in a day or two.

> IndexWriter.addIndexes* can deadlock in rare cases
> --------------------------------------------------
>
>                 Key: LUCENE-1200
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1200
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.4
>
>         Attachments: LUCENE-1200.patch
>
>
> In somewhat rare cases it's possible for addIndexes to deadlock
> because it is a synchronized method.
> Normally the merges that are necessary for addIndexes are done
> serially (with the primary thread) because they involve segments from
> an external directory.  However, if mergeFactor of these merges
> complete then a merge becomes necessary for the merged segments, which
> are not external, and so it can run in the background.  If too many BG
> threads need to run (currently > 4) then the "pause primary thread"
> approach adopted in LUCENE-1164 will deadlock, because the addIndexes
> method is holding a lock on IndexWriter.
> This was appearing as a intermittant deadlock in the
> TestIndexWriterMerging test case.
> This issue is not present in 2.3 (it was caused by LUCENE-1164).
> The solution is to shrink the scope of synchronization: don't
> synchronize on the whole method & wrap synchronized(this) in the right
> places inside the methods.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (LUCENE-1200) IndexWriter.addIndexes* can deadlock in rare cases

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1200?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-1200.
----------------------------------------

    Resolution: Fixed

> IndexWriter.addIndexes* can deadlock in rare cases
> --------------------------------------------------
>
>                 Key: LUCENE-1200
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1200
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.4
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.4
>
>         Attachments: LUCENE-1200.patch
>
>
> In somewhat rare cases it's possible for addIndexes to deadlock
> because it is a synchronized method.
> Normally the merges that are necessary for addIndexes are done
> serially (with the primary thread) because they involve segments from
> an external directory.  However, if mergeFactor of these merges
> complete then a merge becomes necessary for the merged segments, which
> are not external, and so it can run in the background.  If too many BG
> threads need to run (currently > 4) then the "pause primary thread"
> approach adopted in LUCENE-1164 will deadlock, because the addIndexes
> method is holding a lock on IndexWriter.
> This was appearing as a intermittant deadlock in the
> TestIndexWriterMerging test case.
> This issue is not present in 2.3 (it was caused by LUCENE-1164).
> The solution is to shrink the scope of synchronization: don't
> synchronize on the whole method & wrap synchronized(this) in the right
> places inside the methods.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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