Hi,

I am experiencing a behavior that may be related to the mentioned
problem.

My Servlet uses the Comet interfaces of Tomcat 6.
For debugging purposes, when my Servlet receives a BEGIN event, it
stores a request counter in an atttribute of the HttpServletRequest
object.
(This is done to see in the logs to which request a subsequent READ, END
or ERROR event is related.)

Before setting the attribute, the servlet checks whether the attribute
is already set:

if (event.getEventType() == CometEvent.EventType.BEGIN)
{
     HttpServletRequest request = event.getHttpServletRequest( );
     Long index = (Long) request.getAttribute(INDEX_ATTRIBUTE);
     if (index == null)
     {
         index = nextRequestIndex(); 
         request.setAttribute(INDEX_ATTRIBUTE, index);
         requestCount++;
     }
     else
     {
         myLogger.warn("Found old request attribute ("
         + index + ") in BEGIN event!");
     }
     ...

When running tests where several requests are processed at the same
time, I occasionally see the log message appear.

It looks as if sometimes recycling of a request object is not yet
completed when the object is already reused for a new request.
I cannot tell if a similar behavior occurs in my tests also for request
parameters because my tests don't pay much attention on the parameters.

The 'old attributes' problem occurs as well with the APR connector as
with the NIO connector, and I guess that also the 'wrong request
parameters' problem only occurs with these two connectors, as they are
prepared to handle Comet requests and therefore have a modified request
processing (compared to the Http11Processor) also for 'regular' servlet
requests.

What connector are you using with Tomcat 6?

If it is the APR connector (i.e. if you have the tcnative-1 library in
your library path), you could try if the problem disappears when you
switch to the Http11Protocol.


Matthias


> -----Original Message-----
> From: Dejan Krsmanovic [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, May 29, 2007 8:13 AM
> To: Tomcat Users List
> Subject: Re: Web application receives request parameters sent 
> to another application on Tomcat 6
> 
> I am aware of that. We are printing request parameters inside 
> Servlet's
> doPost method.
> 
> Dejan
> 
> Len Popp wrote:
> > It is possible that Tomcat resuses request objects. I'm not sure it
> > does, but it might. For that reason, you're only allowed to use the
> > request object in your servlet's doGet or doPost method, you can't
> > stash it somewhere (e.g. in the HttpSession) and access it later.
> > (This is mentioned in the servlet spec.) Of course I don't know if
> > that's your problem, it's just something that came to mind.
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to