# MassIndexer consistently stops at 684,000

**URL:** <https://discourse.hibernate.org/t/massindexer-consistently-stops-at-684-000/1648>\
**Category:** Hibernate Search\
**Created:** [November 5, 2018, 7:19pm UTC](https://discourse.hibernate.org/t/massindexer-consistently-stops-at-684-000/1648 "2018-11-05T19:19:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lstimmel](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lstimmel](https://discourse.hibernate.org/u/lstimmel)\
**Post date:** [November 5, 2018, 7:19pm UTC](https://discourse.hibernate.org/t/massindexer-consistently-stops-at-684-000/1648/1 "2018-11-05T19:19:45Z")

</div>

When using the MassIndexer to index approximately 2.5 million “incidents”, it consistently stops at exactly 684,000. But, the indexer reports success. The index only contains 684,000 entries. Threads and Heap are not a problem. There are 300 connections available in the dB pool. I am using JPA and here is my code:

```auto
@TransactionAttribute(TransactionAttributeType.NEVER)
	public void index() {
		MassIndexerProgressMonitor monitor = new IndexingProgressMonitor();
		FullTextEntityManager fullTextEntityManager = getFullTxtEntityManager(em);
				
		try {
			MassIndexer massIndexer = fullTextEntityManager.createIndexer(Incident.class);
			
			massIndexer.purgeAllOnStart(true) //default
					.optimizeAfterPurge(true) //default
					.optimizeOnFinish(true) //default
					.threadsToLoadObjects(10)
					.batchSizeToLoadObjects(100)
					.idFetchSize(1000)
					.progressMonitor(monitor)
					.cacheMode(CacheMode.IGNORE) //default
					.startAndWait();
		} catch (Exception e) {
			log.log(Level.SEVERE, "MassIndexer failed. See log for details.", e);
		} finally {
			fullTextEntityManager.flushToIndexes();
			fullTextEntityManager.close();
		}
	}

```

I will appreciate any suggestions.

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [November 6, 2018, 7:52am UTC](https://discourse.hibernate.org/t/massindexer-consistently-stops-at-684-000/1648/2 "2018-11-06T07:52:04Z")

</div>

There are many possible causes for mass indexing failures, so the most pressing matter here is to get information about what went wrong.

Did you check your logs? It’s possible that one of the (many) threads failed and died with an error message in the logs.

Also:

- Please check that you are using the default [error handler](https://docs.jboss.org/hibernate/search/5.10/reference/en-US/html_single/#exception-handling) and that logs are not silenced for the logger named `org.hibernate.search.exception.impl.LogErrorHandler`. For example run something like this just before indexing, and check that the message appears in your logs:

```auto
org.jboss.logging.Logger.getMessageLogger(
    org.hibernate.search.util.logging.impl.Log.class,
    org.hibernate.search.exception.impl.LogErrorHandler.class.getName()
).exceptionOccurred("THIS IS A TEST", new RuntimeException());

```

- Can you reproduce the issue with a different database vendor? E.g. did you try h2, or some other database that is simple enough to set up?

If none of the above shows the source of the problem… well, we’ll need more information. Please at least provide:

- The versions of Search and ORM you are using
- A list of the various Hibernate Search integrations you are using (ES integration or Lucene? JGroups/JMS backend or not? …)
- The logs of indexing (preferably set at the `DEBUG` level for `org.hibernate` and `TRACE` for `org.hibernate.search`, but lower it as necessary if it’s spitting out gigabytes of logs)
- The vendor and version of the database you’re using
- The framework you’re using (JavaEE, I assume? WildFly, maybe?)
- The source code of your `Incident` class and any class that is `@IndexedEmbedded` from `Incident`, if possible.

---

<div class="post-metadata">

**Author:** ![lstimmel](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lstimmel](https://discourse.hibernate.org/u/lstimmel)\
**Post date:** [November 6, 2018, 5:29pm UTC](https://discourse.hibernate.org/t/massindexer-consistently-stops-at-684-000/1648/3 "2018-11-06T17:29:17Z")

</div>

Thank you for you quick response and advice. I will give your suggestions a try.

---

<div class="post-metadata">

**Author:** ![lstimmel](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@lstimmel](https://discourse.hibernate.org/u/lstimmel)\
**Post date:** [November 8, 2018, 3:42pm UTC](https://discourse.hibernate.org/t/massindexer-consistently-stops-at-684-000/1648/4 "2018-11-08T15:42:10Z")

</div>

Using the logging as suggested, showed that I was running into a data problem. To be honest, I didn’t even know that Hibernate had its own logging. I sincerely appreciate the time and attention given to solve my problem.

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [November 8, 2018, 3:44pm UTC](https://discourse.hibernate.org/t/massindexer-consistently-stops-at-684-000/1648/5 "2018-11-08T15:44:10Z")

</div>

No problem. Glad I could help!
