IntelliJ Error: java.lang.OutOfMemoryError: GC overhead limit exceeded
Asked Answered
T

3

12

I'm running Grails 2.5.0 on IntelliJ Idea Ultimate Edition 2020.2.2 . It compiles and builds the code just fine but it keeps throwing a "java.lang.OutOfMemoryError: GC overhead limit exceeded" error (the entire error is copy and pasted at the end). Here are the things I've tried based off researching this error:

1.) Increasing build process heap size (tried at 2G, 4G, and 6G) https://intellij-support.jetbrains.com/hc/en-us/community/posts/360003315120-GC-overhead-limit-exceeded

2.) Increasing memory heap size (tried at 2G, 4G, and 6G) https://www.jetbrains.com/help/idea/increasing-memory-heap.html

3.) Increasing the maximum memory setting for the JVM in the launch configuration (tried at 2G, 4G, and 6G)

I saw that one of the fixes for this error is to "Reuse existing objects when possible to save some memory." However I believe strongly that this is not an issue with the code but with settings on my IDE. The code I am using works fine without errors on the production website and this OutOfMemoryError only appears on my local machine. I would appreciate any help anyone can give, thank you!!!

2020-09-21 09:19:56.661 ERROR --- [nio-8805-exec-3] o.s.l.agent.SpringLoadedPreProcessor     : Unexpected problem transforming call sites

org.springsource.loaded.ReloadException: Unexpected problem locating the bytecode for ch/qos/logback/classic/spi/IThrowableProxy.class
    at org.springsource.loaded.TypeRegistry.couldBeReloadable(TypeRegistry.java:775)
    at org.springsource.loaded.TypeRegistry.isReloadableTypeName(TypeRegistry.java:942)
    at org.springsource.loaded.TypeRegistry.isReloadableTypeName(TypeRegistry.java:780)
    at org.springsource.loaded.MethodInvokerRewriter$RewriteClassAdaptor$RewritingMethodAdapter.visitMethodInsn(MethodInvokerRewriter.java:1133)
    at sl.org.objectweb.asm.ClassReader.a(Unknown Source)
    at sl.org.objectweb.asm.ClassReader.b(Unknown Source)
    at sl.org.objectweb.asm.ClassReader.accept(Unknown Source)
    at sl.org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.springsource.loaded.MethodInvokerRewriter.rewrite(MethodInvokerRewriter.java:348)
    at org.springsource.loaded.MethodInvokerRewriter.rewrite(MethodInvokerRewriter.java:99)
    at org.springsource.loaded.TypeRegistry.methodCallRewriteUseCacheIfAvailable(TypeRegistry.java:1002)
    at org.springsource.loaded.agent.SpringLoadedPreProcessor.preProcess(SpringLoadedPreProcessor.java:361)
    at org.springsource.loaded.agent.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:107)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at ch.qos.logback.classic.spi.ThrowableProxy.<init>(ThrowableProxy.java:55)
    at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:119)
    at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:419)
    at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
    at ch.qos.logback.classic.Logger.log(Logger.java:765)
    at org.slf4j.bridge.SLF4JBridgeHandler.callLocationAwareLogger(SLF4JBridgeHandler.java:221)
    at org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:303)
    at java.util.logging.Logger.log(Logger.java:738)
    at java.util.logging.Logger.doLog(Logger.java:765)
    at java.util.logging.Logger.logp(Logger.java:1042)
    at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:182)
    at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:148)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:251)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException: null
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springsource.loaded.TypeRegistry.couldBeReloadable(TypeRegistry.java:718)
    ... 54 common frames omitted
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.util.Arrays.copyOfRange(Arrays.java:3664)
    at java.lang.String.<init>(String.java:207)
    at java.lang.StringBuilder.toString(StringBuilder.java:407)
    at java.io.UnixFileSystem.resolve(UnixFileSystem.java:108)
    at java.io.File.<init>(File.java:367)
    at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:1331)
    at sun.misc.URLClassPath$FileLoader.findResource(URLClassPath.java:1301)
    at sun.misc.URLClassPath.findResource(URLClassPath.java:225)
    at java.net.URLClassLoader$2.run(URLClassLoader.java:572)
    at java.net.URLClassLoader$2.run(URLClassLoader.java:570)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findResource(URLClassLoader.java:569)
    at java.lang.ClassLoader.getResource(ClassLoader.java:1096)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springsource.loaded.TypeRegistry.couldBeReloadable(TypeRegistry.java:718)
    at org.springsource.loaded.TypeRegistry.isReloadableTypeName(TypeRegistry.java:942)
    at org.springsource.loaded.TypeRegistry.isReloadableTypeName(TypeRegistry.java:780)
    at org.springsource.loaded.MethodInvokerRewriter$RewriteClassAdaptor$RewritingMethodAdapter.visitMethodInsn(MethodInvokerRewriter.java:1133)
    at sl.org.objectweb.asm.ClassReader.a(Unknown Source)
    at sl.org.objectweb.asm.ClassReader.b(Unknown Source)
    at sl.org.objectweb.asm.ClassReader.accept(Unknown Source)
    at sl.org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.springsource.loaded.MethodInvokerRewriter.rewrite(MethodInvokerRewriter.java:348)
    at org.springsource.loaded.MethodInvokerRewriter.rewrite(MethodInvokerRewriter.java:99)
    at org.springsource.loaded.TypeRegistry.methodCallRewriteUseCacheIfAvailable(TypeRegistry.java:1002)
    at org.springsource.loaded.agent.SpringLoadedPreProcessor.preProcess(SpringLoadedPreProcessor.java:361)
    at org.springsource.loaded.agent.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:107)
    at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
    at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
    at java.lang.ClassLoader.defineClass1(Native Method)

2020-09-21 09:19:57.566 ERROR --- [nio-8805-exec-3] .a.c.c.C.[.[.[.[grailsDispatcherServlet] : Servlet.service() for servlet [grailsDispatcherServlet] in context with path [] threw exception

java.lang.reflect.UndeclaredThrowableException: null
    at org.springframework.util.ReflectionUtils.rethrowRuntimeException(ReflectionUtils.java:316)
    at org.grails.web.servlet.mvc.GrailsWebRequest.<init>(GrailsWebRequest.java:106)
    at grails.plugin.springsecurity.web.access.intercept.AnnotationFilterInvocationDefinition.determineUrl(AnnotationFilterInvocationDefinition.groovy:106)
    at grails.plugin.springsecurity.web.access.intercept.AbstractFilterInvocationDefinition.getAttributes(AbstractFilterInvocationDefinition.groovy:75)
    at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:197)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:124)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at grails.plugin.springsecurity.web.filter.GrailsHttpPutFormContentFilter.doFilterInternal(GrailsHttpPutFormContentFilter.groovy:54)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at javax.servlet.FilterChain$doFilter.call(Unknown Source)
    at grails.plugin.springsecurity.rest.RestTokenValidationFilter.processFilterChain(RestTokenValidationFilter.groovy:121)
    at grails.plugin.springsecurity.rest.RestTokenValidationFilter.doFilter(RestTokenValidationFilter.groovy:87)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at grails.plugin.springsecurity.rest.RestAuthenticationFilter.doFilter(RestAuthenticationFilter.groovy:139)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.groovy:64)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at grails.plugin.springsecurity.web.SecurityRequestHolderFilter.doFilter(SecurityRequestHolderFilter.groovy:58)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException: null
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1076)
    at org.grails.web.servlet.mvc.GrailsWebRequest.<init>(GrailsWebRequest.java:102)
    ... 63 common frames omitted
Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.lang.reflect.Method.copy(Method.java:153)
    at java.lang.reflect.ReflectAccess.copyMethod(ReflectAccess.java:140)
    at sun.reflect.ReflectionFactory.copyMethod(ReflectionFactory.java:316)
    at java.lang.Class.copyMethods(Class.java:3124)
    at java.lang.Class.getMethods(Class.java:1615)
    at java.beans.MethodRef.find(MethodRef.java:76)
    at java.beans.MethodRef.get(MethodRef.java:62)
    at java.beans.PropertyDescriptor.getReadMethod(PropertyDescriptor.java:207)
    at groovy.lang.MetaClassImpl.applyPropertyDescriptors(MetaClassImpl.java:2527)
    at groovy.lang.MetaClassImpl.setupProperties(MetaClassImpl.java:2265)
    at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:3338)
    at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3303)
    at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:289)
    at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:331)
    at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:341)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:281)
    at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:901)
    at org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:934)
    at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:926)
    at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToBoolean(DefaultTypeTransformation.java:198)
    at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.booleanUnbox(DefaultTypeTransformation.java:87)
    at org.grails.web.context.ServletEnvironmentGrailsApplicationDiscoveryStrategy.findApplicationContext(ServletEnvironmentGrailsApplicationDiscoveryStrategy.groovy:61)
    at grails.util.Holders.findApplicationContext(Holders.java:106)
    at org.grails.web.servlet.DefaultGrailsApplicationAttributes.<init>(DefaultGrailsApplicationAttributes.java:74)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1076)
    at org.grails.web.servlet.mvc.GrailsWebRequest.<init>(GrailsWebRequest.java:102)
    at grails.plugin.springsecurity.web.access.intercept.AnnotationFilterInvocationDefinition.determineUrl(AnnotationFilterInvocationDefinition.groovy:106)
    at grails.plugin.springsecurity.web.access.intercept.AbstractFilterInvocationDefinition.getAttributes(AbstractFilterInvocationDefinition.groovy:75)

Exception in thread "http-nio-8805-exec-3" java.lang.OutOfMemoryError: GC overhead limit exceeded
Texas answered 21/9, 2020 at 16:36 Comment(5)
Only 3) will make sense here. Can you show the screenshot of the run/debug configuration with the correct memory setting?Doi
Sure thing! Screenshot Images here These are the two different configurations I've tried. Let me know if you need any other information!Texas
Why do you have $ at the end of the option on the first screenshot?Doi
Whoops, I'm sorry that's a typo when I was manually re-entering it in for the screenshot. It was definitely supposed to be just "-Xmx6G". I tested both just now (without typos) and I still hit the error again. Would appreciate any insight, thank you!Texas
Try adding these options as well in the VM Options field of the run configuration: -XX:MaxPermSize=700m -XX:ReservedCodeCacheSize=480m.Doi
U
26

The simplest possible solution could be, increase the build process heap size as shown below. Definitely this would help.

enter image description here

Unclench answered 6/1, 2021 at 12:49 Comment(0)
M
1

This worked for me and build ok.

enter image description here

Myrna answered 29/11, 2022 at 18:22 Comment(1)
Thanks, other than simply adding the compiler's heap size, this resolves my problem!Thirtieth
C
0

try to increase compiler heap size. enter image description here

Cassandracassandre answered 6/10, 2022 at 15:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.