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

Yonik Seeley commented on SOLR-7836:
------------------------------------

Here's the scenario w/ the old code.

thread1 does an add:
  1) in DUH2, calls coreState.getIndexWriter()
     - this increments the ref count on the writer and sets 
coreState.writerFree=false
  2) calls UpdateLog.add

thread2 calls core reload():
  3) calls coreState.newIndexWriter()
     - coreState.pauseWriter is set to true, so no new references will be 
handed out
     - goes into a loop waiting for writerFree=true (for all other references 
that were handed out to be returned)

thread1:
  4) UpdateLog.add continues and indirectly causes coreState.getIndexWriter() 
to be called
    - sees coreState.pauseWriter set to true and thus does into wait loop

So: one can't call getIndexWriter() and then do anything else that will 
eventually call getIndexWriter() or newIndexWriter()
If we keep that restriction, then moving the ulog.add outside of the 
getIndexWriter/release block was correct.

Don't know about the other changes... the extra sync added in DUH2 does still 
seem unnecessary.  And I haven't looked at what changes were made to 
SolrCoreState yet.


> Possible deadlock when closing refcounted index writers.
> --------------------------------------------------------
>
>                 Key: SOLR-7836
>                 URL: https://issues.apache.org/jira/browse/SOLR-7836
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Erick Erickson
>            Assignee: Erick Erickson
>             Fix For: Trunk, 5.4
>
>         Attachments: SOLR-7836-synch.patch, SOLR-7836.patch, SOLR-7836.patch, 
> SOLR-7836.patch, deadlock_3.res.zip, deadlock_5_pass_iw.res.zip, deadlock_test
>
>
> Preliminary patch for what looks like a possible race condition between 
> writerFree and pauseWriter in DefaultSorlCoreState.
> Looking for comments and/or why I'm completely missing the boat.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to