Near Real Time produces NPEs in worker thread on first flush

Description

13:34:02,078 ERROR [org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask] (Hibernate Search: Index updates queue processor for index org.jboss.as.quickstarts.kitchensink.model.Member-1) HSEARCH000073: Error in backend: java.lang.NullPointerException at org.hibernate.search.backend.impl.lucene.NRTWorkspaceImpl.flush(NRTWorkspaceImpl.java:171) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final] at org.hibernate.search.backend.impl.lucene.NRTWorkspaceImpl.afterTransactionApplied(NRTWorkspaceImpl.java:79) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final] at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.applyUpdates(LuceneBackendQueueTask.java:138) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final] at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.run(LuceneBackendQueueTask.java:67) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [classes.jar:1.6.0_31] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [classes.jar:1.6.0_31] at java.util.concurrent.FutureTask.run(FutureTask.java:138) [classes.jar:1.6.0_31] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_31] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_31] at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31] 13:34:02,099 ERROR [org.hibernate.search.exception.impl.LogErrorHandler] (Hibernate Search: Index updates queue processor for index org.jboss.as.quickstarts.kitchensink.model.Member-1) HSEARCH000058: Exception occurred java.lang.NullPointerException Primary Failure: Entity org.jboss.as.quickstarts.kitchensink.model.Member Id 1 Work Type org.hibernate.search.backend.AddLuceneWork Subsequent failures: Entity org.jboss.as.quickstarts.kitchensink.model.Member Id 2 Work Type org.hibernate.search.backend.AddLuceneWork Entity org.jboss.as.quickstarts.kitchensink.model.Member Id 3 Work Type org.hibernate.search.backend.AddLuceneWork Entity org.jboss.as.quickstarts.kitchensink.model.Member Id 4 Work Type org.hibernate.search.backend.AddLuceneWork java.lang.NullPointerException at org.hibernate.search.backend.impl.lucene.NRTWorkspaceImpl.flush(NRTWorkspaceImpl.java:171) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final] at org.hibernate.search.backend.impl.lucene.NRTWorkspaceImpl.afterTransactionApplied(NRTWorkspaceImpl.java:79) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final] at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.applyUpdates(LuceneBackendQueueTask.java:138) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final] at org.hibernate.search.backend.impl.lucene.LuceneBackendQueueTask.run(LuceneBackendQueueTask.java:67) [hibernate-search-engine-4.1.0.Final.jar:4.1.0.Final] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [classes.jar:1.6.0_31] at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [classes.jar:1.6.0_31] at java.util.concurrent.FutureTask.run(FutureTask.java:138) [classes.jar:1.6.0_31] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_31] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_31] at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]
@Entity @XmlRootElement @Table(uniqueConstraints = @UniqueConstraint(columnNames = "email")) @Indexed public class Member implements Serializable { /** Default value included to remove warning. Remove or modify at will. **/ private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long id; @NotNull @Size(min = 1, max = 25) @Pattern(regexp = "[A-Za-z ]*", message = "must contain only letters and spaces") @Field private String name; @NotNull @NotEmpty @Email private String email; @NotNull @Size(min = 10, max = 12) @Digits(fraction = 0, integer = 12) @Column(name = "phone_number") private String phoneNumber; @NotEmpty @Size(min = 2, max = 50) @Field private String location; @NotEmpty @Size(min = 2, max = 50) @Field private String job;
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="primary"> <!-- If you are running in a production environment, add a managed data source, this example data source is just for development and testing! --> <!-- The datasource is deployed as WEB-INF/kitchensink-quickstart-ds.xml, you can find it in the source at src/main/webapp/WEB-INF/kitchensink-quickstart-ds.xml --> <jta-data-source>java:jboss/datasources/KitchensinkQuickstartDS</jta-data-source> <properties> <!-- Properties for Hibernate --> <property name="hibernate.hbm2ddl.auto" value="create-drop" /> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.search.default.indexmanager" value="near-real-time"/> <property name="hibernate.search.default.directory_provider" value="ram"/> </properties> </persistence-unit> </persistence>

When I comment <property name="hibernate.search.default.indexmanager" value="near-real-time"/>, it works

Activity

Show:

Sanne Grinovero April 24, 2012 at 12:27 PM
Edited

Ok it seems to happen only on first series of index updates, and only if no query was ever run before.

Sanne Grinovero April 24, 2012 at 12:16 PM

I'm actually having this fail with fs directory as well: same stacktrace.
Just that functionality is not affected in this case, as it kills the thread in the executor after having applied the work on the index. And the killed thread is then replaced by the Executor.

Fixed

Details

Assignee

Reporter

Components

Affects versions

Priority

Created April 12, 2012 at 1:51 PM
Updated May 8, 2013 at 9:04 AM
Resolved April 24, 2012 at 2:23 PM