> From: André Warnier [[email protected]]
> Sent: Thursday, December 26, 2013 2:11 PM
> To: Tomcat Users List
> Subject: Re: Request Timeout and empty post data issue
>
>Peter Rifel wrote:
>> Hello,
>>
>> I'm currently running Tomcat 7.0.42 on Ubuntu 12.04 with OpenJDK 1.7.0_25.
>> I'm using Apache Tomcat Native library 1.1.27 with APR version 1.4.6.
>>
>> I'm noticing in my access logs that some of our POST requests don't have any
>> POST data and all have response times of a few ms over 20000ms. I'm trying
>> to figure out whether this issue is client side or server side. The
>> response code and response size for these requests are normal. Can anyone
>> tell me under what circumstances this would happen? I noticed that our
>> connector's connectionTimeout is set to 20000ms, but it wouldn't make sense
>> for that value to be a part of this issue because a connection timeout only
>> occurs when the URI hasn't been received by tomcat in that amount of time,
>> which is clearly not happening here (I was able to confirm this with telnet;
>> a connection timeout will not write anything to the access logs).
>>
>> The "request" is making it to my servlet (logging confirms this) but for
>> some reason tomcat doesn't see any request parameters and all of the
>> response times in our access logs are just above 20 seconds. Does this mean
>> that my servlet is taking 20 seconds to process the request? Is there some
>> other timeout value somewhere that defaults to 20 seconds? Is there a way
>> for me to see exactly what is taking so long? Its incredibly hard to debug
>> this because we cant reproduce this bug on our own without any post data and
>> <1% of our production traffic is having this issue. To try and gather more
>> info on this, I added a servlet filter that logs all of our POST request
>> parameters to the access log and I can confirm that there are no parameters
>> on these specific requests.
>>
>> The lack of post data makes me think its a client issue, but that doesn't
>> explain why all of these requests take ~20 seconds to be processed.
>>
>> I'd appreciate any ideas on what could cause this.
>>
>
>Can't think of an answer yet, but what would help is if you posted the
>corresponding
><Connector> configuration here.
>
>I am a bit puzzled by your description of the servlet filter above.
>How does it determine that the request has no POST parameters ?
>And how/what does it log to the Access log ?
>
>Also, can you get to the HTTP headers of the request, in this filter ?
>It may be useful to know what the request's "Content-length" header is saying.
>
>And one more thing : presumably, you know what kind of POST requests this is,
>or what it
>should be. What would a normal POST request of that kind look like ?
>For example if it was a valid/legitimate POST request of that kind from a
>valid/legitimate
>client (browser ?), how large could it be, as a maximum ?
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>
>
Here is the <Connector> configuration:
<Connector executor="HttpThreadPool" port="8080" protocol="HTTP/1.1"
pollerSize="25000" pollerThreadCount="2"
connectionTimeout="20000" redirectPort="8443" server="MixpoServer"
maxPostSize="10485760"
compression="on"
compressableMimeType="text/html,text/plain,text/xml,application/xml,text/javascript"
noCompressionUserAgents=".*MSIE[56].*"
/>
The filter is a snippet I found online while trying to debug this that just
loops through the parameter names and values, creating a string:
public void doFilter(ServletRequest request, ServletResponse
response,FilterChain chain) throws IOException, ServletException {
Enumeration<String> names = request.getParameterNames();
StringBuffer output=new StringBuffer();
while (names.hasMoreElements()) {
String name = names.nextElement();
output.append(name+"=");
String values[] = request.getParameterValues(name);
for (int i = 0; i < values.length; i++) {
if (i > 0) output.append("' ");
output.append(values[i]);
}
if(names.hasMoreElements()) output.append("&");
}
request.setAttribute("postdata", output);
chain.doFilter(request, response);
}
Then I just added "%{postdata}r" to my access log valve format. If you know of
a better way of dumping POST data to a log of some sort without interfering
with the servlet I'm open for alternatives. I'll try and log the
Content-length header as well. The requests are made by a custom flash plugin
that runs on all browsers, the post data is only plaintext: just a handful of
name/value pairs.
Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]