Grails GORM stops working after redeployment because can not load data from DB

Viewed 143

After our application redeployment, we sometimes see a problem when the whole GORM stops working with a weird reason

25-Apr-2021 07:00:45.351 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 48663 ms
25-04-2021 07:00:47 ERROR org.springframework.boot.context.web.ErrorPageFilter - Forwarding to error page from request [/api/<any request>] due to exception [No row with the given identifier exists: [com.test.auth.Role#1001]]
org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.test.auth.Role#1001]
    at org.hibernate.internal.SessionFactoryImpl$1$1.handleEntityNotFound(SessionFactoryImpl.java:253)
    at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:262)
    at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:176)
    at org.grails.orm.hibernate.proxy.SimpleHibernateProxyHandler.unwrapProxy(SimpleHibernateProxyHandler.java:79)
    at org.grails.orm.hibernate.cfg.GrailsHibernateUtil.unwrapProxy(GrailsHibernateUtil.java:390)
    at org.grails.orm.hibernate.cfg.HibernateUtils$_handleLazyProxy_closure1.doCall(HibernateUtils.groovy:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
...

This problem appears randomly and can be raised by any first API request (or Quartz job run) after redeployment and can be related to any domain class in the system. The data is correct in DB and all "native" SQL queries work without any problems.

We have no locks on DB (can do any SQL query to any mentioned table) and ~10 instances of Grais web services connected to the same DB. Also, we have

dbCreate: none 

for all instances

Any thoughts about the possible reason? This issue is causing us tremendous problems during the deployment process.

  • Grails version 3.1.16

  • MySQL 5.7 (Aurora)

0 Answers
Related