Grails
  1. Grails
  2. GRAILS-4387

StackOverflowError when using controllerName in a filter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.3.7
    • Component/s: None
    • Labels:
      None
    • Environment:
      This has been reproduced in Tomcat 6.x

      Description

      Sometimes, and with no apparent reason, I get a infinite loop of StackOverflowError's, resulting on gigas of logfiles .

      The application is a production one, usually stable, using Grails 1.1. The error is:

       
      GRAVE: El Servlet.service() para servlet grails lanzó una excepción
      java.lang.StackOverflowError
             at org.apache.catalina.connector.RequestFacade.getAttribute(RequestFacade.java:263)
             at org.apache.catalina.core.ApplicationHttpRequest.getAttribute(ApplicationHttpRequest.java:222)
             at org.apache.catalina.core.ApplicationHttpRequest.getAttribute(ApplicationHttpRequest.java:222)
             at org.apache.catalina.core.ApplicationHttpRequest.getAttribute(ApplicationHttpRequest.java:222)
             [... tons of this one ...]
             at org.apache.catalina.core.ApplicationHttpRequest.getAttribute(ApplicationHttpRequest.java:222)
             at org.apache.catalina.core.ApplicationHttpRequest.getAttribute(ApplicationHttpRequest.java:222)
              at org.apache.catalina.core.ApplicationHttpRequest.getAttribute(ApplicationHttpRequest.java:222)
              at org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest.getControllerName(GrailsWebRequest.java:184)
              at sun.reflect.GeneratedMethodAccessor2855.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
              at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
              at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1584)
              at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:938)
              at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3275)
              at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:951)
              at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:158)
              at org.codehaus.groovy.runtime.callsite.PojoMetaClassGetPropertySite.callGetProperty(PojoMetaClassGetPropertySite.java:41)
              at org.codehaus.groovy.grails.web.plugins.support.WebMetaUtils$_registerCommonWebProperties_closure10.doCall(WebMetaUtils.groovy:87)
              at sun.reflect.GeneratedMethodAccessor657.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
              at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:81)
              at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
              at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:1584)
              at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:938)
              at groovy.lang.MetaClassImpl.getProperty(MetaClassImpl.java:3275)
              at groovy.lang.ExpandoMetaClass.getProperty(ExpandoMetaClass.java:951)
              at org.codehaus.groovy.grails.plugins.web.filters.FilterConfig.getProperty(FilterConfig.groovy)
              at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:153)
              at groovy.lang.Closure.getPropertyTryThese(Closure.java:187)
              at groovy.lang.Closure.getPropertyDelegateFirst(Closure.java:180)
              at groovy.lang.Closure.getProperty(Closure.java:165)
              at org.codehaus.groovy.runtime.InvokerHelper.getProperty(InvokerHelper.java:153)
              at groovy.lang.Closure.getPropertyTryThese(Closure.java:187)
              at groovy.lang.Closure.getPropertyOwnerFirst(Closure.java:203)
              at groovy.lang.Closure.getProperty(Closure.java:173)
              at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:47)
              at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:240)
              at SecurityFilters$_closure1_closure2_closure6.doCall(SecurityFilters.groovy:12)
              [... thousand lines to follow ...]
      

      Our affected class is:

               at SecurityFilters$_closure1_closure2_closure6.doCall(SecurityFilters.groovy:12)

      SecurityFilters.groovy:12 is

                      if (controllerName != 'auth') {
      

      The last class in the stack just before the loop is:

               org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest.getControllerName(GrailsWebRequest.java:184)

        Activity

        Hide
        Peter Ledbrook added a comment -

        This is currently happening on grails.org with Grails 1.2.2.

        Show
        Peter Ledbrook added a comment - This is currently happening on grails.org with Grails 1.2.2.
        Hide
        Peter Ledbrook added a comment - - edited

        This may be a symptom of another issue. Grails seems to get into a recursive state with the error handling. Witness the start of one stack trace:

        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
        	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
         	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
         	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
         	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
         	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
         	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
         	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
         	at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:302)
         	at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:278)
         	at org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver.resolveException(GrailsExceptionResolver.java:107)
         	at org.springframework.web.servlet.DispatcherServlet.processHandlerException(DispatcherServlet.java:1004)
         	at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:292)
         	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
         	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
         	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
         	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
         	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
         	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
         	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70)
         	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
         	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
         	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
         	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
         	at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:302)
         	at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:278)
         	at org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver.resolveException(GrailsExceptionResolver.java:107)
         	at org.springframework.web.servlet.DispatcherServlet.processHandlerException(DispatcherServlet.java:1004)
         	at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:292)
         	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
        

        Sometimes an error page is eventually displayed, but sometimes it hits the stack overflow problem.

        Show
        Peter Ledbrook added a comment - - edited This may be a symptom of another issue. Grails seems to get into a recursive state with the error handling. Witness the start of one stack trace: at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:302) at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:278) at org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver.resolveException(GrailsExceptionResolver.java:107) at org.springframework.web.servlet.DispatcherServlet.processHandlerException(DispatcherServlet.java:1004) at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:292) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:70) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:302) at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(WebUtils.java:278) at org.codehaus.groovy.grails.web.errors.GrailsExceptionResolver.resolveException(GrailsExceptionResolver.java:107) at org.springframework.web.servlet.DispatcherServlet.processHandlerException(DispatcherServlet.java:1004) at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:292) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) Sometimes an error page is eventually displayed, but sometimes it hits the stack overflow problem.
        Hide
        Peter Ledbrook added a comment -

        I believe this has been fixed. I haven't seen the error on grails.org for a long time.

        Show
        Peter Ledbrook added a comment - I believe this has been fixed. I haven't seen the error on grails.org for a long time.
        Hide
        Tony Copping added a comment -

        Funny... I'm seeing this in a production application running grails 1.3.6.
        So there was a specific fix done in 1.3.7, or was it marked as fixed because nobody has seen it in a while?

        Show
        Tony Copping added a comment - Funny... I'm seeing this in a production application running grails 1.3.6. So there was a specific fix done in 1.3.7, or was it marked as fixed because nobody has seen it in a while?
        Hide
        Alvaro Sanchez-Mariscal added a comment -

        I originally experienced it, but it was 2,5 years ago. With newer versions of Grails, the error dissapeared.

        Show
        Alvaro Sanchez-Mariscal added a comment - I originally experienced it, but it was 2,5 years ago. With newer versions of Grails, the error dissapeared.

          People

          • Assignee:
            Peter Ledbrook
            Reporter:
            Alvaro Sanchez-Mariscal
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development