-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Unable to update index on master (JMS replication)
PostPosted: Wed Jul 27, 2016 9:39 am 
Newbie

Joined: Wed Jul 27, 2016 7:16 am
Posts: 1
Implementing a JMS based replication for my Lucene index with Hibernate search I am facing this issue.

When the master node as a consumer at the activeMQ-server fetching data and tries to update his index, this fails with a NullPointer and this following stack trace:

Quote:
2016-07-27 10:45:45,621 ERROR [Hibernate Search sync consumer thread for index users] (LogErrorHandler.java:67) HSEARCH000058: Exception occurred org.hibernate.search.exception.SearchException: Unable to update class com.sobis.cmdb.model.SettingDocu#8a81838755e43e0a0155e44f65e10000 in index.
Primary Failure:
Entity com.sobis.jaf.model.security.User Id 8a8183875597702d0155977117c20008 Work Type org.hibernate.search.backend.UpdateLuceneWork
Subsequent failures:
Entity com.sobis.jaf.model.security.User Id 8a8183875597702d0155977117c20008 Work Type org.hibernate.search.backend.UpdateLuceneWork

org.hibernate.search.exception.SearchException: Unable to update class com.sobis.jaf.model.security.User#8a8183875597702d0155977117c20008 in index.
at org.hibernate.search.backend.impl.lucene.works.UpdateExtWorkExecutor.performWork(UpdateExtWorkExecutor.java:77)
at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.performWork(LuceneBackendQueueTask.java:111)
at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.applyUpdates(LuceneBackendQueueTask.java:91)
at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.run(LuceneBackendQueueTask.java:46)
at org.hibernate.search.backend.impl.lucene.SyncWorkProcessor$Consumer.applyChangesets(SyncWorkProcessor.java:162)
at org.hibernate.search.backend.impl.lucene.SyncWorkProcessor$Consumer.run(SyncWorkProcessor.java:148)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.apache.lucene.index.TermsHashPerField.add(TermsHashPerField.java:150)
at org.apache.lucene.index.DefaultIndexingChain$PerField.invert(DefaultIndexingChain.java:661)
at org.apache.lucene.index.DefaultIndexingChain.processField(DefaultIndexingChain.java:344)
at org.apache.lucene.index.DefaultIndexingChain.processDocument(DefaultIndexingChain.java:300)
at org.apache.lucene.index.DocumentsWriterPerThread.updateDocument(DocumentsWriterPerThread.java:234)
at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:450)
at org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1475)
at org.hibernate.search.backend.impl.lucene.IndexWriterDelegate.updateDocument(IndexWriterDelegate.java:74)
at org.hibernate.search.backend.impl.lucene.works.UpdateExtWorkExecutor.performWork(UpdateExtWorkExecutor.java:71)
... 6 more


On further investigations I found out, that the error is caused by an term attribute that is null after the method setAttributeSource in the Lucene class org.apache.lucene.index.FieldInvertState. In this method the attribute is retrieved by the method getAttribute.

The weird aspect is that on each try on different fields the termAttribute is null. The correct value for the termAttribute seems to be blank at this state.

Has anyone an idea, why this error occurs? What information do you need to understand this error? Can it be an configuration issue or is it more likely that it is a strange bug?

Further investigations:
With the blank termAttribute fields in mind i added a null check to the method setAttributeSource and in case of null used addAttribute instead of getAttribute.

Code:
  void setAttributeSource(AttributeSource attributeSource) {
    if (this.attributeSource != attributeSource) {
      this.attributeSource = attributeSource;
      termAttribute = attributeSource.getAttribute(TermToBytesRefAttribute.class);
      //added the nullcheck
      if(termAttribute == null){
            termAttribute = attributeSource.addAttribute(TermToBytesRefAttribute.class);
      }
      posIncrAttribute = attributeSource.addAttribute(PositionIncrementAttribute.class);
      offsetAttribute = attributeSource.addAttribute(OffsetAttribute.class);
      payloadAttribute = attributeSource.getAttribute(PayloadAttribute.class);
    }
  }


Now all works fine with this fix. It seems, that no required information are lost this way, but I'm not sure.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.