[ 
https://issues.apache.org/jira/browse/SOLR-7836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yonik Seeley updated SOLR-7836:
-------------------------------
    Attachment: SOLR-7836.patch

OK, here's a patch that uses a reentrant read-write lock in 
DefaultSolrCoreState.

Notes:
- no more pauseWriter / freeWriter variables
- readlock is for grabbing the current writer, writeLock is for ensuring there 
are no readers
- the RefCounted<IndexWriter> doesn't do much any more... decRef releases the 
readLock, that's the only important thing.  I just kept it to keep the API the 
same for now.
- all of newIndexWriter, closeIndexWriter, and openIndexWriter all delegate to 
changeIndexWriter to remove duplicated code.  This does change the semantics of 
some of these methods, but I hope for the better?
   -- The old openIndexWriter method only synchronized on writerPauseLock, so 
if there were any readers and writers in the lock loop, or even readers open, 
this method could go in and still change the writer anyway.  Sharing the code 
in changeWriter now means that it would wait for any readers to finish (which 
looking at the comments implies there should not be anyway?  and if there were, 
new IW creation would fail)

- I reordered some things so that if we got an exception while opening a new 
writer, the writer reference would already be cleared so we won't simply 
default to using the old (presumably now closed) writer, but will try to open 
again.  Should be more resilient in the face of a spurious exception.
- it's really not clear if polling is still needed in getIndexWriter, but I 
kept it for now just to be safe.

looping some tests now...

> 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-reorg.patch, SOLR-7836-synch.patch, 
> SOLR-7836.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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to