tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@eng.sun.com
Subject Re: Tomcat 3.2 beta3? problem with mod_jk
Date Thu, 31 Aug 2000 20:03:23 GMT
Hi Larry,

Maybe "SO_LINGER" will help ?

If not, probably we should look for the  fix on the C side. I have no idea how
Windows works, but I'm sure there is some flag or way to ignore the "abort".
( or keep receiving ).

I'll do some searching, but this is a long weekend so probably I'll not
have anything this week.

( mod_jserv is different in the fact that it uses the Apache method.
We should be able to use the same trick - that makes me think we
should look at C if linger doesn't help. The good news is that we'll
learn something very intersting !)

Costin






> Hi Costin,
>
> Thanks for the information. This does appear to be a problem with unread input.
>
> The failing test sends a POST for a non-existent servlet along with some content.  When
socket.close() is reached in processConnection() in Ajp12ConnectionHandler.java, the content
of the POST is still unread.
>
> I noticed a "try - catch" in processConnection() in HttpConnectionHandler.java that tries
to skip "available" input.  I tried it in Ajp12ConnectionHandler.java, but it didn't fix the
problem. The following code placed in Ajp12ConnectionHandler.java showed that "try - catch"
wasn't sufficient to dump the unread input.
>
>     //resA.finish(); // is part of contextM !
>     // *** TEST ***
>     int available = in.available();
>     if (available == 0) {
>         for (int i = 0; i < 20; i++) {
>             java.lang.Thread.yield();
>             available = in.available();
>             if (available != 0) {
>                 System.out.println("Input can arrive during close!");
>                 break;
>             }
>         }
>     }
>     // *** END TEST ***
>     socket.close();
>
> The "Input can arrive during close!" message appears occasionally in the system output
when I execute the failing test repeatedly.  I also tried the following as a patch:
>
>     //resA.finish(); // is part of contextM !
>     try {
>         socket.setSoTimeout(100);
>         if (contentLength != -1) {
>             BufferedServletInputStream sis =
>                 (BufferedServletInputStream)reqA.getInputStream();
>
>             while (sis.read() != -1)
>                 ; // discard any unread content
>         }
>         int available = in.available();
>         if (available > 0)
>             in.skip(available);
>     }
>     catch (IOException ex) {
>         // ignore since we are just cleaning up
>     }
>     socket.close();
>
> This seems to fix the problem.  However, I'm not comfortable assuming that all un-read
content should be read in all cases.  Perhaps you, or someone more informed on the issues
than me, could come up with a better patch.  As the comment in HttpConnectionHandler mentioned,
it is a shame that Socket.shutdownInput() is only available in JDK 1.3. :^(
>
> When this problem occurs, the Apache reports a 500 error which hides the actual error.
 I would prefer to see this fixed in Tomcat 3.2 if a patch deemed "safe" can be found.
>
> Since I don't see errors accessing Tomcat directly, I'm not sure if something needs to
be addressed in HttpConnectionHandler.  Maybe a POST to a non-existent servlet which carries
more content would cause the same problem for HttpConnectionHandler too.
>
> Next, I'll try test-tomcat.xml on Ajp13 and see what happens.
>
> Cheers,
> Larry
>
> -----Original Message-----
> From: cmanolache@yahoo.com [mailto:cmanolache@yahoo.com]
> Sent: Wednesday, August 30, 2000 1:56 PM
> To: tomcat-dev@jakarta.apache.org
> Subject: Re: Tomcat 3.2 beta3? problem with mod_jk
>
> Hi Larry,
>
> AFAIK mod_ajp12 should work in exactly the same way as mod_jserv.
>
> One possible explanation is that tomcat is closing the connection without
> reading the full request body, and that generates an abort signal that is
> received by mod_jk before the actual response data.
>
> <snip>
> ...
> </snip>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message