Uploaded image for project: 'GeoServer'
  1. GeoServer
  2. GEOS-7833

Monitoring with body logging enabled breaks servlets/handlers using request.getReader()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.9.3, 2.10.1
    • Component/s: Monitoring
    • Labels:
      None

      Description

      If any servlet/handler calls getReader and body logging is enabled then a stack trace like the following will appear:

      25D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - getReader() has already been called for this request</h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u>getReader() has already been called for this request</u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.IllegalStateException: getReader() has already been called for this request
      	org.apache.catalina.connector.Request.getInputStream(Request.java:1080)
      	org.apache.catalina.connector.RequestFacade.getInputStream(RequestFacade.java:367)
      	javax.servlet.ServletRequestWrapper.getInputStream(ServletRequestWrapper.java:131)
      	javax.servlet.ServletRequestWrapper.getInputStream(ServletRequestWrapper.java:131)
      	javax.servlet.ServletRequestWrapper.getInputStream(ServletRequestWrapper.java:131)
      	javax.servlet.ServletRequestWrapper.getInputStream(ServletRequestWrapper.java:131)
      	org.geoserver.monitor.MonitorServletRequest.getInputStream(MonitorServletRequest.java:48)
      	org.geoserver.monitor.MonitorServletRequest.getBodyContent(MonitorServletRequest.java:32)
      	org.geoserver.monitor.MonitorFilter.getBody(MonitorFilter.java:214)
      	org.geoserver.monitor.MonitorFilter.doFilter(MonitorFilter.java:147)
      	org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:71)
      

      This is because monitoring only buffers getInputStream but delegates getReader to its base class

        Attachments

          Activity

            People

            • Assignee:
              aaime Andrea Aime [Administrator]
              Reporter:
              aaime Andrea Aime [Administrator]
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: