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





------- Additional Comments From [EMAIL PROTECTED]  2007-06-28 02:47 -------
(In reply to comment #5)
> If you follow the code logic, if the error happens, where available() returns 
> >0
> after a READ has been invoked, the connection is never marked as a comet, so 
> you
> will not get the ERROR/END events invoked. so the connection goes into the
> poller for the next request.
> Could you see if you can work up a reproducible scenario, and we can take it
> from there.

When I look in the code I see the following:

                if (response.isClosed() || !request.isComet()) {
                    res.action(ActionCode.ACTION_COMET_END, null);
                } 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);

So when you get the error, the condition response.isClosed() ||
!request.isComet() must evaluate to false, which means that !response.isClosed()
&& request.isComet(). So for me to get the error it seems the request must
already be marked as a comet request.

I am not able to give you a small test case. The problem is that I have two
different products that start an embedded tomcat using exactly the same class,
and in one it consistently works (no errors whatsoever), and in the other it
consistently fails. I have not seen this issue before (and I have already done a
lot of testing in different situations), and I have no idea what the
precondition is for this issue to manifest itself.

However, I added extra debugging information, and I did find something strange.
I do the following logging FIRST thing in my Comet processor and I wrapped the
input stream to log which thread does the reading:

  final EventType eventType = event.getEventType();
  if (Debug.ENABLED && logger.isDebugEnabled()) {
    try {
      final Field field = request.getClass().getDeclaredField("request");
//$NON-NLS-1$
      field.setAccessible(true);
      final Request internalRequest = (Request) field.get(request);
      logger.debug("{} event for request facade {}, request {}", new Object[] {
eventType, request, internalRequest }); //$NON-NLS-1$
    } catch (final Exception e) {
      logger.debug("{} event for request facade {}", eventType, request);
//$NON-NLS-1$
      logger.debug("failed to get request", e); //$NON-NLS-1$
    }
  }

I set a breakpoint in the CoyoteAdapter where it gives the SEVERE error, looked
at the id of the request object, and checked my log what events I got for that
object.

My results where as follows:

2007-06-28 11:16:00,021 DEBUG [http-8080-exec-4]
com.sebster.myservlet.MyCometServlet - BEGIN event for request facade
[EMAIL PROTECTED], request
[EMAIL PROTECTED]

This was the ONLY line in the log with [EMAIL PROTECTED] All the reads in this
BEGIN event happen on the http-8080-exec-4 thread. After returning from the read
(due to available() == 0), it immediately stops in my breakpoint in
CoyoteAdapter to log the SEVERE error. Note that I first set the break point to
find the id of the Request object to look for in the log.

The strange thing is, that the breakpoint happens in the http-8080-exec-5
thread. The comet field in the [EMAIL PROTECTED] object is set to true, and
request.getAvailable() also returns true.

These are my observations so far. Note that I am no expert on Tomcat internals,
but I am very willing to spend time on this issue to resolve it, so any tips,
suggestions, questions, or assignments :-) are welcome!

To summarize:
1) I get a BEGIN event for [EMAIL PROTECTED] in http-8080-exec-4
2) I read until available() == 0 in http-8080-exec-4
3) I return from the event() method in http-8080-exec-4
4) Tomcat logs a SEVERE error stating that I have not read all data
     * The request object is [EMAIL PROTECTED]
     * request.isComet() == true
     * request.getAvailable() == true
     * the thread is http-8080-exec-5
     * at this point there are zero log lines for thread http-8080-exec-5

Regards,
Sebastiaan








-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to