tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastiaan van Erk <>
Subject read data/infinite loop problem with comet
Date Tue, 26 Jun 2007 13:17:27 GMT

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()

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 
2007-06-26 14:37:08,427 DEBUG [http-8080-exec-4] 
com.sebster.myservlet.TomcatCometServlet - POST 
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?


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

View raw message