I've narrowed this down even further. As I mentioned below, the "0\r\n\r\n" was not being sent to nginx, although it was being sent to curl. The difference was that nginx was doing a GET HTTP/1.0, while curl was using HTTP/1.1. If I configure curl to use HTTP/1.0 then I get the same result: no "0\r\n\r\n" is sent.
So, to summarize: - GET HTTP/1.0 results in no terminating "0\r\n\r\n" for the chunked response, regardless of whether libtcnative is being used. - The difference when using libtcnative is that the connection isn't terminated after the response is sent. Chris On March 10, 2011 10:33:00 am Chris wrote: > Hi All, > Yesterday I created bug 50906 for this issue: > https://issues.apache.org/bugzilla/show_bug.cgi?id=50906 > > Since then I've got some more details to add: > > - I'm running with nginx in front of tomcat > - The 60 second timeout is happening in nginx and not tomcat > - Regardless of whether or not I'm using libtcnative, I don't see the > terminating "0\r\n\r\n" being sent by tomcat to nginx > - When *not* using libtcnative, the connection is closed after writing the > response; there's a FIN, in addition to ACK on the last TCP packet from > tomcat. Nginx seems to use this to infer the end of the response and add the > "0\r\n\r\n" to the reply sent to the client. > - When using libtcnative, there is no FIN on the last TCP ACK packet, and the > connection stays open. One minute later nginx times out waiting for the > response to complete and adds the "0\r\n\r\n" to the response to the client. > - I notice that if I use curl to make a request directly to tomcat (instead > of going through nginx), then I do see the terminating "0\r\n\r\n". I still > see a difference in that tomcat disconnects immediately after the reply when > *not* using the native library. > > Any ideas? > > Thanks, > Chris > > On March 9, 2011 04:56:22 pm Mark Thomas wrote: > > On 09/03/2011 21:49, Chris wrote: > > > Hi, > > > I'm using Tomcat 7.0.8 on Ubuntu 10.10. > > > > > > When using the APR based Tomcat Native Library (libtcnative), responses > > > from Tomcat are being sent with a chunked encoding, but the "0" > > > terminating the chunked response isn't sent until exactly 1 minute later. > > > > > > The response is being written to an > > > org.apache.catalina.connector.CoyoteOutputStream. The following calls are > > > made: > > > out.write(resp); > > > out.flush(); > > > out.close(); > > > > > > If I just remove the libtcnative-1.so, so that Tomcat loads without using > > > it, then the response still uses chunked encoding, but the terminating > > > "0" is sent immediately, with the rest of the response. > > > > > > Any ideas would be appreciated. > > > > Sounds like a bug. Please create a bugzilla entry. > > > > Mark > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > For additional commands, e-mail: users-h...@tomcat.apache.org > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org