tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike W-M" <m...@ward-murphy.co.uk>
Subject Re: Simultaneous request from same IP
Date Tue, 17 Dec 2002 01:07:42 GMT
Chris,

I've played around with a servlet almost identical to your original (not
full!) test-case (below).  (Did you actually get the problem to appear on
this one or is it just a theoretical cut-down of the larger example you
posted later?)
I've made - not exactly concurrent, but definitely sub-second-apart -
requests from two instances of Internet Explorer.  (Nifty finger/mouse
coordination.)
I cannot reproduce your "confused" results.  [I've even added a
thread.sleep(10000) into the servlet to ensure that the requests are running
(or at least in existence) concurrently. ]

I still can't think of anything you're doing in the servlet that would
produce the results you describe.
I (still) think that the problem is most likely with your "simultaneous
requests" themselves.  How are you making these requests - via code?  Can
you reproduce the problem with nifty-I.E. fingerwork?

Mike.

----- Original Message -----
From: "Chris Bick" <cbick@wurldmedia.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Monday, December 16, 2002 3:13 PM
Subject: RE: Simultaneous request from same IP


Thanks for responding.  I don't think it is an instance variable
problem. Here is the code to reproduce the problem:

public class AServlet extends HttpServlet {
  public void doGet(HttpServletRequest request, HttpServletResponse
reponse) throws ServletException, IOException {

  printWriter pw = reponse.getWriter();
  reponse.setContentType("text/html");

  synchronized(System.out)
  {
System.out.println("Query String: " + request.getQueryString());
      System.our.println("Header      : "
+request.getHeader("Test-Header");
  }

  out.println("Done");
}

Two different request hit this servlet about 1 sec apart everything is
fine.  It's only when they enter the servlet at the same time.

I will submit a bug report if know one sees a problem with the above
code.

-cb
-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Sunday, December 15, 2002 10:22 PM
To: Tomcat Users List
Subject: Re: Simultaneous request from same IP



On Sun, 15 Dec 2002, Chris Bick wrote:

> Date: Sun, 15 Dec 2002 22:05:45 -0500
> From: Chris Bick <cbick@wurldmedia.com>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> To: tomcat-user@jakarta.apache.org
> Subject: Simultaneous request from same IP
>
> Hello,
>             Has anyone seen two requests from the same IP hitting a
> servlet at approximately the time result in the same query string and
> headers?
>
> I can reproduce this every time.  Make two requests from one machine
> that hits my servlet at approximately the same time.   Both
> HttpServletRequest objects contain query string and header information
> of the first request in.  If the IPs are different everything works
> properly.
>

This seems *much* more likely to be a thread-safety problem in your user
code than a bug in Tomcat.  For example, using instance variables in
your
servlet to store per-request state information is pretty much guaranteed
to have difficulties.

The only way to know for sure would be for you to post a bug report
(http://nagoya.apache.org/bugzilla/) with a reproducible test case, so
that Tomcat developers can see what you are seeing.

> Thanks,
> -cb
>

Craig



--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>




--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message