On bootstrap failure the SessionFactory is closed without propagating the root cause

Description

In case of misconfiguration it is possible that HibernateSearchSessionFactoryObserver triggers the close() operation of the SessionFactory it is attempting to integrate with, without propagating the root cause.

We should never swallow such exceptions, as e.g. WildFly doesn't realize the deployment failed.

Environment

None

Activity

Show:
Sanne Grinovero
May 22, 2018, 12:54 PM

More specifically, this is the issue I had:

an integration test is attempting to load the Infinispan DirectoryProvider to run integration tests.

Because of a mistake in my build scripts, the WildFly module was not declaring the dependency to the module providing this implementation, so causing an initialization failure on the directory provider.

However, to figure this out it was (too) complex as the only actually reported error was :

I finally figured that the HibernateEntityCacheStatistics would fail because

  • statistics had not been initialized yet

  • the EntityManagerFactory had been closed (by Search)

Also fixed to make WildFly more robust: https://issues.jboss.org/browse/WFLY-10413

Ultimately I believe the real problem was that WildFly didn't realize that the deployment had failed. So the deployment status was "in limbo" and the management threads were trying to manage something (e.g. fetching statistics) which was not meant to be managed.

An integration test should verify that:

  • indeed a deployment is marked as "failed"

  • the real problem is not swallowed but clearly logged among other WildFly errors

N.B. to figure out this wasn't a problem with Wildfly's statistics but just a DirectoryProvider configuration issue I had to use the debugger, as we were not giving any clue.

Also related:

Assignee

Yoann Rodière

Reporter

Sanne Grinovero

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Affects versions

Priority

Major
Configure