You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Vincent Massol <vm...@octo.com> on 2001/12/21 19:27:16 UTC

RE: [Tomcat 3.3] Strange behaviour w/ mixed POST/GET request (NOT solved)

I have spoken a bit too fast ... :-(

It worked 3 times in a row and then started failing again, same as
before. It failed even after removing all connection.disconnect() and
all close on streams related to the connection but the failure rate
seems to be lower ...

I've just run the tests 10 times and the result is :
Ok, ok, nok, ok, ok, ok, nok, nok, nok, nok

I've tried to write a sample test case to reproduce it but cannot (in
other words, it works all the time with the simple test case).

I'm a bit stuck and don't know what to do now ... Any idea ?
Thanks
-Vincent

> -----Original Message-----
> From: Vincent Massol [mailto:vmassol@octo.com]
> Sent: 21 December 2001 17:27
> To: 'Tomcat Users List'
> Subject: RE: [Tomcat 3.3] Strange behaviour w/ mixed POST/GET request
> (solved)
> 
> I have found the reason ... My code was the equivalent of :
> 
> URL url = new
URL("http://localhost:8080/examples/snoop?param1=value1");
> HttpURLConnection connection =
(HttpURLConnection)url.openConnection();
> connection.setDoInput(true);
> connection.setDoOutput(true);
> connection.setUseCaches(false);
> connection.setRequestProperty("Content-type",
> "application/x-www-form-urlencoded");
> 
> PrintWriter out = new PrintWriter(connection.getOutputStream());
> out.print("param2=value2");
> out.close();
> connection.connect();
> connection.getInputStream().close();
> 
> And this throws an error. The problem is with the last line which
works
> fine with all other servlet engines but not Tomcat 3.3. If I change it
> to :
> 
> connection.disconnect();
> 
> it now works fine. This probably means that when the connection is
> closed it tries to close the underlying input stream and does not
verify
> if it is already closed (or something like this).
> 
> Thanks and sorry for the trouble.
> -Vincent
> 
> > -----Original Message-----
> > From: Vincent Massol [mailto:vmassol@octo.com]
> > Sent: 21 December 2001 16:15
> > To: 'Tomcat Users List'
> > Cc: 'Larry Isaacs'
> > Subject: RE: [Tomcat 3.3] Strange behaviour w/ mixed POST/GET
request
> >
> >
> >
> > > -----Original Message-----
> > > From: ian silvester [mailto:ians@is2.co.uk]
> > > Sent: 21 December 2001 15:18
> > > To: Tomcat Users List
> > > Subject: Re: [Tomcat 3.3] Strange behaviour w/ mixed POST/GET
> request
> > >
> > > Hmm.
> > >
> > > The fact that you only get this behaviour in 3.3 suggests very
> > strongly a
> > > problem in that release. Is there any reason why you can't use a
> > different
> > > release and avoid the error?
> > >
> >
> > Because in the framework I am working on (Jakarta Cactus), I need to
> > support all servlet engines (including Tomcat 3.3) :-)
> >
> > > That aside, I have seen this error under different circumstances -
> > doing a
> > > response.sendredirect in a JSP _after_ having already output HTML
to
> > the
> > > browser. For this to error is fair enough - its supposedly outside
> the
> > > HTTP
> > > spec. to send redirects after having started outputting HTML (in
> ASP,
> > MS
> > > being the hand-holders that they are, attempting to do this throws
a
> > > runtime
> > > error so as to avoid unexpected behaviour).
> > >
> > > Could your code be construed as doing something similar? If yes,
> then
> > you
> > > cannot guarantee that it will work on all combintaions of browser
> and
> > > server.
> > >
> >
> > There is no sendredirect in my code but I may be doing something not
> in
> > the spec ... As suggested by Larry Isaacs, I'm going to open a bug
in
> > bugzilla with details on the test case. However, it is going to take
> > some time as I need to extract the relevant portion from the code. I
> > hoped someone was going to say something like : "yes, we know, we
have
> > an issue when you're sending parameter in the URL at the same time
as
> in
> > the request body" ... :-)
> >
> > In the meantime (before I finish extracting the code), some more
> > information on the code logic (client side) :
> >
> > 1/ open an http connection to Tomcat 3.3 using HttpURLConnection and
> > read all returned data (with attached AutoReadHttpURLConnection
class)
> :
> >
> >   HttpURLConnection connection = helper.connect(theRequest);
> >   connection = new AutoReadHttpURLConnection(connection);
> >   // Trigger the transfer of data
> >   connection.getInputStream();
> >
> > On the server side, some code is executed and a result is set in the
> > application context.
> >
> > 2/ open a second connection to the server using HttpURLConnection
and
> > get the test result (sent back as an ObjectOutputStream)
> >
> > Repeat 1/ and 2/ for all the requests I mentioned in my previous
mail
> > (the mixed POST/GET one and the other GET ones).
> >
> > Thanks
> > -Vincent
> >
> > > ian
> > >
> > > ----- Original Message -----
> > > From: "Vincent Massol" <vm...@octo.com>
> > > To: <to...@jakarta.apache.org>
> > > Sent: Friday, December 21, 2001 2:44 PM
> > > Subject: [Tomcat 3.3] Strange behaviour w/ mixed POST/GET request
> > >
> > >
> > > > I have a strange behaviour in Tomcat 3.3 that does not happen
> either
> > in
> > > > Tomcat 4.x or in Tomcat 3.2.x (or any other servlet engine for
the
> > > > matter : Orion, Resin, WebLogic). It looks like voodoo for me
and
> I
> > have
> > > > trouble understanding what's happening.
> > > >
> > > > I am sending several different HTTP requests (using
> > HttpURLConnection)
> > > > to the server and depending on the order I get or do not get an
> > error.
> > > > When I get the error, it is the typical :
> > > >
> > > > Connection aborted by peer: JVM_recv in socket input stream read
> > > > java.net.SocketException: Connection aborted by peer: JVM_recv
in
> > socket
> > > > inp
> > > > ut stream read
> > > >    at java.net.SocketInputStream.socketRead(Native Method)
> > > >
> > > > I am doing one special request in which I send _both_ GET
> parameters
> > (in
> > > > the URL) and parameters in the request body (POST method). The
> other
> > > > requests are only GET requests.
> > > >
> > > > If I call the mixed POST/GET request first, followed by the
other
> > GET
> > > > requests then everything is fine. However, if I start by doing
on
> > GET
> > > > request and then followed by the mixed POST/GET one, I get the
> > > > connection aborted by peer error.
> > > >
> > > > Any idea ? Any known issues with mixed POST/GET requests ?
> > > >
> > > > Thanks a lot for any hint as I'm beginning to tear my hair ...
:-)
> > > > -Vincent
> > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe:
> > <ma...@jakarta.apache.org>
> > > > For additional commands:
> > <ma...@jakarta.apache.org>
> > > > Troubles with the list:
> > <ma...@jakarta.apache.org>
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe:
> <ma...@jakarta.apache.org>
> > > For additional commands:
> <ma...@jakarta.apache.org>
> > > Troubles with the list:
> <ma...@jakarta.apache.org>
> > >
> 
> 
> 
> 
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>
> 




--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>