We're updating the issue view to help you get more done. 

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

Description

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

1 2 3 4 5 6 7 8 9 10 11 12 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

Environment

None

Status

Assignee

Andrea Aime

Reporter

Andrea Aime

Triage

None

Fix versions

Affects versions

None

Components

Priority

Medium