[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-dev
Subject:    DO NOT REPLY [Bug 42753]  New:  - Race condition when using available() or reading in CometProcessor
From:       bugzilla () apache ! org
Date:       2007-06-27 12:21:54
Message-ID: bug-42753-78 () http ! issues ! apache ! org/bugzilla/
[Download RAW message or body]

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42753>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42753

           Summary: Race condition when using available() or reading in
                    CometProcessor.event()
           Product: Tomcat 6
           Version: unspecified
          Platform: All
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: sebster@sebster.com


Tomcat version: 6.0.13 (no 6.0.13 available in the version field)

When trying to process data in CometProcessor.event() either during the BEGIN
event or during the READ event, it is impossible to guarantee that all data has
been read before returning (since new data may arrive between the last statement
before the return, and the return statement itself). However, the
CoyoteProcessor does this check:

 } 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"));
 } 

causing a severe error and the Comet request to break when this race condition
manifests itself.

I am using the following code according to the aio.html description to read data
in my comet event handler:

  while (request.getInputStream().available() > 0) {
     // read some data
  }
  // ***** NO MORE DATA AVAILABLE
  return;

And I am experiencing the error as described in certain conditions (rapid
arrival of fragmented data):

SEVERE: The servlet did not read all available bytes during the processing of
the read event

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic