erichmx opened a new issue, #14473: URL: https://github.com/apache/grails-core/issues/14473
I'm having a weird error with a plugin, but I think it is a race condition in HibernateMappingContextConfiguration, long story short, it gives me a NullPointerException on the line [266](https://github.com/grails/gorm-hibernate5/blob/master/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/HibernateMappingContextConfiguration.java#L260) `((ServiceRegistryImplementor)serviceRegistry).destroy();` From what I see, **the SessionFactoryObserver is set before the serviceRegistry is created** therefore leading to a NPE in some cases, and so my app runs some times and other times it flops with NPE. I don't really understand why sessionFactoryImple.Close() is being called, and this may be another problem. ```java setSessionFactoryObserver(new SessionFactoryObserver() { private static final long serialVersionUID = 1; public void sessionFactoryCreated(SessionFactory factory) {} public void sessionFactoryClosed(SessionFactory factory) { ((ServiceRegistryImplementor)serviceRegistry).destroy(); } }); StandardServiceRegistryBuilder standardServiceRegistryBuilder = createStandardServiceRegistryBuilder(bootstrapServiceRegistry) .applySettings(getProperties()); StandardServiceRegistry serviceRegistry = standardServiceRegistryBuilder.build(); sessionFactory = super.buildSessionFactory(serviceRegistry); this.serviceRegistry = serviceRegistry; ``` Am I wrong thinking this may produce a race condition? Here is more detail of issue https://github.com/mathpere/grails-hibernate-search-plugin/issues/33 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
