lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "vijaykumarraja.grandhi (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENENET-308) TestIndexWriter.TestThreadInterruptDeadlock
Date Thu, 26 Aug 2010 11:59:54 GMT

    [ https://issues.apache.org/jira/browse/LUCENENET-308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12902831#action_12902831
] 

vijaykumarraja.grandhi commented on LUCENENET-308:
--------------------------------------------------

Hi,

I am currently using LUCENE Net 2.9.2 version. We have upgraded from v1.9.0 to 2.9.2. Basically
we want to use threading concept now. But i am strucked with a lock. How to over come with
these locks. Can any one provide .net code sample. Thank you in advance. 

Please help me. Slowly all my trails are getting dried out. failing to resolve multi threading
with Lucene. It is getting deadlog. Always I am seeing some Write.Lock file inside Index folder.


Vijay Kumar Raja.Grandhi

> TestIndexWriter.TestThreadInterruptDeadlock
> -------------------------------------------
>
>                 Key: LUCENENET-308
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-308
>             Project: Lucene.Net
>          Issue Type: Bug
>            Reporter: Andrei Iliev
>         Attachments: TestIndexWriter.patch
>
>
> 2 problems with the test:
> 1) There is no .Net equivalent for java's java.lang.Thread.interrupted() and interrupted
bit  => we can not check if IW restored interrupted bit (there is no such bit).
> 2)  Sometimes test fails with exception:
> An unhandled System.NullReferenceException was thrown while executing this test : Object
reference not set to an instance of an object.
> In seems that in java statement  "synchronized(this) "
> will never throw an InterruptedException but in .Net  statement lock(this) can throw
such exception. Because of this the inner exception sometimes will be null => cause System.NullReferenceException
exception.
> Here's a snippet of code from the ConcurrentMergeScheduler
> =============
> lock (this) // (1)
>                     {
>                         MergeThread merger;
>                         while (MergeThreadCount() >= maxThreadCount)
>                         {
>                             if (Verbose())
>                                 Message("    too many merge threads running; stalling...");
>                             try
>                             {
>                                 System.Threading.Monitor.Wait(this);  // (2)
>                             }
>                             catch (System.Threading.ThreadInterruptedException ie)
>                             {
>                                 // In 3.0 we will change this to throw
>                                 // InterruptedException instead
>                                 SupportClass.ThreadClass.Current().Interrupt();
>                                 throw new System.SystemException(ie.Message, ie);
>                             }
>                         }
> =============
> In java  ThreadInterruptedException can  be thrown only in position (2). But in .Net
it can be  at  postion (1) as well.
> I choose the easiest fix: check  not only inner exception but the  exception  as well
> if(re is System.Threading.ThreadInterruptedException || e is System.Threading.ThreadInterruptedException)
> As alternative we have to fix many places in ConcurrentMergeScheduler  by
> -finding lock(this),
> -add try , and  catch  blocks in the following way:
> catch (System.Threading.ThreadInterruptedException ie)
>                             {
>                                 // In 3.0 we will change this to throw
>                                 // InterruptedException instead
>                                 SupportClass.ThreadClass.Current().Interrupt();
>                                 throw new System.SystemException(ie.Message, ie);
>                             }

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


Mime
View raw message