Grails 4 allows Controller to extend a non-trait. Core dumps in Grails 5
Expected Behavior
Large application running without issuing with multiple controllers extending a BaseController (non-trait) in grails 4.
Expected to be able to upgrade to Grails 5 without it core dumping.
Actual Behaviour
Core dump with difficult to interpret dump
`RAX=0x0000000000000000 is an unknown value
RBX={method} {0x000000012530a571} '
- klass: 'java/lang/IllegalStateException'`
Steps To Reproduce
Create controller in Grails 5 that extends a non-trait.
Watch as
((GroovyObject)this).setProperty "modelAndView", new ModelAndView(viewUri, model)
inside ResponseRenderer yields an AbstractMethodError but won't in Grails 4
Environment Information
Temurin 1.8 b322
Example Application
No response
Version
5.1.4
Create controller in Grails 5 that extends a non-trait.
See the project at github.com/jeffbrown/jagarciaissue12443.
grails-app/controllers/jagarciaissue12443/DemoController.groovy
package jagarciaissue12443
class DemoController extends BaseController {
def index() {
render 'DemoController success'
}
}
grails-app/controllers/jagarciaissue12443/AnotherDemoController.groovy
package jagarciaissue12443
class AnotherDemoController extends BaseController {
def index() {
render 'AnotherDemoController success'
}
}
Can you test that and report back to indicate if that project also core dumps?
Separate from that, which JDK are you using when you are seeing the core dump?
Thank you for the feedback.
I hit this core dump on temurin 1.8 b322 and AdoptOpenJDK 1.8 b252. In your example project I don't see the BaseController definition. Did you set it as an abstract class?
After lots of testing yesterday to confirm my build was stable post patch, I just went in and re-created the problem. This time the base controller didn't have any services injected into it, so its not related to that.
I don't see the BaseController definition.
BaseController is defined at src/main/groovy/jagarciaissue12443/BaseController.groovy.
It was made abstract in the commit at https://github.com/jeffbrown/jagarciaissue12443/commit/6c85e18f6ca3fd5bbf023098d75590d77834867d.
It would be helpful if you could send a PR to that repo which recreates the problem or if you could create a similar sample app which demonstrates the problem.
Thank you for the feedback!
Hi @jeffbrown I did some work and isolated it to the introduction of the following dependency in the dependencies block:
agent "org.springframework:springloaded:1.3.0.BUILD-20210404.024037-2"
Unfortunately I've been unable to migrate to JDK9+ due to the super slow hotswap/restart times of grails in the absence of springloaded. I even tried JRebel and still have super slow retart times.
As you know springloaded only currently supports JDK8
FYI... I do see the error after adding agent "org.springframework:springloaded:1.3.0.BUILD-20210404.024037-2".
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x0000000000000000, pid=10964, tid=0x0000000000009703
#
# JRE version: OpenJDK Runtime Environment (Zulu 8.36.0.1-CA-macosx) (8.0_202-b05) (build 1.8.0_202-b05)
# Java VM: OpenJDK 64-Bit Server VM (25.202-b05 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C 0x0000000000000000
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/jeffscottbrown/t/jagarciaissue12443/hs_err_pid10964.log
#
# If you would like to submit a bug report, please visit:
# http://www.azulsystems.com/support/
#
I've been working on this a while and there is a decent grails4 spring loaded we use in our nexus i can send later. There is a lot of work going into fixing spring loaded for JDK11 and grails5 that I have finished as well. It is getting very close but still crashes on extremely large projects. There has always existed some race conditions in that code that can be problematic and are more prominent when running in Java 11
@davydotcom if I can send you a coffee or perhaps look into some of the final problems you're tackling, I'd love to help however I can to get that new springloaded version prod ready!
FYI... The core dump I mentioned above came out of JRE version: OpenJDK Runtime Environment (Zulu 8.36.0.1-CA-macosx) (8.0_202-b05) (build 1.8.0_202-b05).