Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 73289 invoked from network); 26 Jun 2007 22:48:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Jun 2007 22:48:21 -0000 Received: (qmail 39126 invoked by uid 500); 26 Jun 2007 22:48:12 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 38848 invoked by uid 500); 26 Jun 2007 22:48:11 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 38835 invoked by uid 99); 26 Jun 2007 22:48:10 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2007 15:48:10 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of sebster@sebster.com designates 213.196.5.53 as permitted sender) Received: from [213.196.5.53] (HELO mail.servoy.com) (213.196.5.53) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 26 Jun 2007 15:48:06 -0700 Received: (qmail 55148 invoked from network); 26 Jun 2007 22:47:45 -0000 Received: from unknown (HELO ?10.0.0.6?) (svanerk@24.132.245.13) by mail.servoy.com with SMTP; 26 Jun 2007 22:47:44 -0000 Message-ID: <46819790.5020203@sebster.com> Date: Wed, 27 Jun 2007 00:47:44 +0200 From: Sebastiaan van Erk User-Agent: Thunderbird 1.5.0.12 (X11/20070604) MIME-Version: 1.0 To: Tomcat Users List Subject: Re: read data/infinite loop problem with comet References: <468111E7.2080001@sebster.com> <46814452.3050604@sebster.com> <23AFECEB22D2FD47ADF828485803B2C001CA0ED9@MCHP7R5A.ww002.siemens.net> In-Reply-To: <23AFECEB22D2FD47ADF828485803B2C001CA0ED9@MCHP7R5A.ww002.siemens.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi, Thanks for the suggestion. I already tried that fix, unfortunately it does not work. The problem is that even without those two lines, the event() method is not called again with a new READ event for the newly available data. That said, the check seems wrong to me as well. If the servlet does not read all the data then I'm all for another call to the event() method. Regards, Sebastiaan Reich, Matthias wrote: > Hi, > > my feeling is that the CoyoteAdapter does a check that should not be > done in this place (just because the implicit assumption is wrong that > nothing will happen concurrently during the few nano seconds between the > Servlet's available() check and the check of the adapter.) > > It looks as if the CoyoteAdapter code does not want to rely on the > Servlet programmer to do the available() checks correctly and therefore > tries to avoid loops of read events which could result from incorrect > Servlet code. > > You could try to simply remove the lines > > >> } 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")); >> } >> > > from the CoyoteAdapter code and run your Comet Servlet with the modified > CoyoteAdapter. > > If it works, suggest this modification as a bug fix. > > > Regards, > Matthias > > >> -----Original Message----- >> From: Sebastiaan van Erk [mailto:sebster@sebster.com] >> Sent: Tuesday, June 26, 2007 6:53 PM >> To: Tomcat Users List >> Subject: Re: read data/infinite loop problem with comet >> >> 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 >>> org.apache.catalina.connector.RequestFacade@d47c99 >>> 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: users-unsubscribe@tomcat.apache.org >>> For additional commands, e-mail: users-help@tomcat.apache.org >>> >>> >> --------------------------------------------------------------------- >> To start a new topic, e-mail: users@tomcat.apache.org >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >> For additional commands, e-mail: users-help@tomcat.apache.org >> >> >> > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org