[hibernate-issues] issue with org.hibernate.search.backend.impl.lucene.SharedIndexWorkspaceImpl

Tobias Carson tobias at buzzstream.com
Wed May 1 14:39:04 EDT 2013


We've observed an issue in SharedIndexWorkspaceImpl that appears to be a
bug.

within
SharedIndexWorkspaceImpl#getIndexWriter()
SharedIndexWorkspaceImpl#getIndexWriter(ErrorContextBuilder
errorContextBuilder)

The openWritersUsers is incremented before an IndexWriter is successfully
obtained.

We are seeing a scenario with two separate jvms writing to the same index
where one process holds a lock long enough to cause a locktimeout and the
second process fails to obtain an IndexWriter (yet it still increments the
openWritersUsers).  Subsequent writes from the second process create a lock
which is never closed due to openWriterUsers being > 0.

Our fix:
@Override
public IndexWriter getIndexWriter() {
synchronized ( lock ) {
IndexWriter indexWriter = super.getIndexWriter();
if(indexWriter != null) {
openWriterUsers++;
}
return indexWriter;
}
}

public IndexWriter getIndexWriter(ErrorContextBuilder errorContextBuilder) {
synchronized ( lock ) {
IndexWriter indexWriter = super.getIndexWriter( errorContextBuilder );
if(indexWriter != null) {
openWriterUsers++;
}
return indexWriter;
}
}

Thanks,
Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20130501/4fdefdf7/attachment.html 


More information about the hibernate-issues mailing list