Hi all,
I looked in the Tomcat source code (6.0.13), and I really do not
understand how I'm supposed to avoid the following error:
SEVERE: The servlet did not read all available bytes during the
processing of the read event
What seems to be happening is this:
In my event method():
while (request.getInputStream().available() > 0) {
// read some data
}
// ***** NO MORE DATA AVAILABLE
return;
A bit later in CoyoteAdapter (187):
// *** SOME DATA ARRIVES SOMEWHERE HERE
} else if (!error && read && request.getAvailable()) {
// If this was a read and not all bytes have been
read, or if no data
// was read from the connector, then it is an error
error = true;
log.error(sm.getString("coyoteAdapter.read"));
}
return (!error);
I checked the source code, and CoyoteInputStream.available() and
Request.getAvailable() both return exactly the same value, namely
InputBuffer.available(). So it seems that between my return and this
check new data arrived has arrived, causing failure. What's worse, my
CometProcessor does not get notified (I don't know why) of the error,
and the Poller goes in an infinite loop.
Does anybody know how I can solve this problem?
Regards,
Sebastiaan
Sebastiaan van Erk wrote:
Hi,
I'm having a problem reading data in my Comet servlet.
In the BEGIN event I have the following loop:
while (request.getInputStream().available() > 0) {
// log that in read loop, log available()
// read some data
}
// log that read loop is done, log available()
return;
However, even though I keep reading until available() returns 0, I get
a SEVERE error complaining I did not read all the available data,
which can be seen from the following logs:
2007-06-26 14:37:08,427 DEBUG [http-8080-exec-4]
com.sebster.myservlet.TomcatCometServlet - BEGIN event for request
[EMAIL PROTECTED]
2007-06-26 14:37:08,427 DEBUG [http-8080-exec-4]
com.sebster.myservlet.TomcatCometServlet - 127.0.0.1:60578 POST
/mycometservlet
2007-06-26 14:37:08,432 DEBUG [http-8080-exec-4]
com.sebster.myservlet.TomcatCometServlet -
[24224039-a37e-40d0-a076-89d1df363390] read loop in BEGIN event, input
stream data available: 1
2007-06-26 14:37:08,438 DEBUG [http-8080-exec-4]
com.sebster.myservlet.TomcatCometServlet -
[24224039-a37e-40d0-a076-89d1df363390] read loop done, input stream
data available: 0
2007-06-26 2:37:08.MD org.apache.catalina.connector.CoyoteAdapter event
SEVERE: The servlet did not read all available bytes during the
processing of the read event
After this, the poller goes into an infinite event handling busy loop.
I looked at what the poller was doing, and it seems to be setting the
comet event into the END event type and trying to call the event
method, however, it never arrives at my Comet processor's event method
(it seems to call an event method on an error valve or though). I
don't know what exactly happens, but I can debug more if necessary.
Does anybody know what the proper way to read ALL the data is, and not
cause this exception to happen?
Regards,
Sebastiaan
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]