tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Fraser" <>
Subject HTTP header details returned by HttpServletRequest.getInputStream()
Date Thu, 06 Jul 2006 07:58:35 GMT
Hi Users,

Our company has a software application that consists of a number of
servlets hosted by the Tomcat webserver (version 5.0.16). One of the
servlets responds to HTTP POST requests, the body of which contains
details about what exactly is being requested. The data in the body is a
simple string sent by our client application; it is not the contents of
a web page.

The problem that has occurred on 2 occassions now is that the servlet
begins throwing exceptions because the format of the data in the body is
not what it expects. When the servlet reports the error, it prints out
the data from the body, and we have found that it contains the complete
HTTP header details at the front of the returned data. The servlet gets
the request body using the HttpServletRequest getContentLength() and
getInputStream() methods. The servlet does NOT use the getParameter()

What has happened both times is that the servlet will go from processing
every request without error, to suddenly failing for every single
request. In both cases, Tomcat/the web application had been running for
about 4-6 weeks before the problem started.

The first time it happened, we tried restarting Tomcat, but this did NOT
fix the problem. Errors started occurring again as soon as the web
server starting processing requests again. We used the packet sniffer
ethereal to see if there was corruption of the data packets coming in
from the network, and found no unexplained errors. We also found that
one of the other servlets, which serves JSPs providing admininstrative
console functionality, seemed to be working fine (the servlet only uses
the HttpServletRequest getParameter() method, not getInputStream(); it
processes both HTTP GET and POST requests). In the end we had to reboot
the machine. The second time, the machine was rebooted immediately
because the system was live at that time.

I have spent quite a bit of time looking at the J2EE Java Doc, this
Tomcat mailing list, and Google of course, without much luck. And given
that the problem has only occurred twice in a core part of our
application, for only one (and our most recent) customer, it's hard to
gather information about it, and virtually impossible to reproduce.

My first question to everybody is: has anyone experienced something
similar to this?
My second question is: can anyone suggest what we might investigate next
or look out for next time?

Given that the machine had to be rebooted would indicate that it is NOT
a problem with Tomcat, and past experience with Tomcat supports this.
However no problems even remotely related are being reported by other
applications on the network, nor the same machine, not even by other
servlets in the same Tomcat instance!

Some miscellaneous information that may be useful:

* application has been running on LINUX Redhat 8,9 and Windows 2000,2003
server,XP using Tomcat 5.0.16 for about 2 years
* no exceptions are being thrown by the HttpServletRequest object when
methods are called on it
* the volume of requests would only be between 50-100 an hour
* the size of the data in the requests would be < 2K
* the machine is a Dell PowerEdge, dual core Intel processor, 2GB
Memory, 1Gb network card, running Windows Server 2003
* no changes to or significant events occurred on the customer
environment at the times the problem started occurring

Apologies for being so verbose, and thanks for taking the time to read
this post.

If you have any questions, please don't hesitate to ask.

Thanks, David.

David Fraser

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message