tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reich, Matthias" <>
Subject Comet: Unsufficiently synchronized recycling decisions
Date Wed, 30 May 2007 12:04:08 GMT

as mentioned in my contribution to topic 'Web application receives
request parameters sent to another application on Tomcat 6', I sometimes
get non-recycled Request objects in a BEGIN event. 

A non-recycled request object appeared in a BEGIN event if the previous
request processed by the same request processor was answered
asynchronously directly after the BEGIN event.

In such a situation my Servlet sometimes did not get an END event, i.e.
the CoyoteAdapter was not triggered again and therefore could not
recycle the Request object.
Nevertheless, the request processor was recycled, i.e. readded to the
processor pool.

As the processor was recycled, the cometEvent.close() must have happened
*after* CoyoteAdapter had made the decision not to recycle
Request/Response, but *before* Http11AprProtocol had made the decision
to recycle the processor.

To verify this, I modified the methods Http11AprProcessor.event and

I replaced every occurrence of:


within these methods with the following lines:

  org.apache.catalina.connector.Request req =
(org.apache.catalina.connector.Request) request.getNote(1);
  org.apache.catalina.connector.Response res =
(org.apache.catalina.connector.Response) response.getNote(1);
  req.recycle( );
  res.recycle( );

I know that this is a hack and must be solved in a better way (and also
for the NIOConnector), but with these modifications I enforced a single
decision point for recycling of Request/Response *and* the processor.

When running Tomcat with these modifications, my Servlet no longer
received non-recycled Request objects.


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

View raw message