When I run the async1 example in trunk, the request gets logged twice in the 
access log:
0:0:0:0:0:0:0:1%0 - - [20/Oct/2010:21:32:39 -0700] "GET /examples/async/async1 
HTTP/1.1" 200 -
0:0:0:0:0:0:0:1%0 - - [20/Oct/2010:21:32:42 -0700] "GET /examples/async/async1 
HTTP/1.1" 200 863

Is this the expected behaviour or should the post-invoke part of AccessLogValve 
be returning early for the first dispatch (when async has been started)?

However, with async2 which calls complete() from a background thread to finish 
the request, only the first dispatch is logged:
0:0:0:0:0:0:0:1%0 - - [20/Oct/2010:22:25:02 -0700] "GET /examples/async/async2 
HTTP/1.1" 200 -
It doesn't look like the Valve is being invoked at all when the request is 
completed.

It also logs the 200 response if I change Async2 to send an error response:
-                    actx.getResponse().getWriter().write("Output from 
background thread. Time:"+System.currentTimeMillis()+"\n");
+                    ((HttpServletResponse)actx.getResponse()).sendError(404);
which seems problematic as it looks form the log that the request was OK. This 
does not send any data back to the client:
$ curl -v http://localhost:8080/examples/async/async2
* About to connect() to localhost port 8080 (#0)
*   Trying ::1... connected
* Connected to localhost (::1) port 8080 (#0)
> GET /examples/async/async2 HTTP/1.1
> User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 
> OpenSSL/0.9.8l zlib/1.2.3
> Host: localhost:8080
> Accept: */*
> 
[[ delays for a few seconds ... ]]
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server
* Closing connection #0

Thanks
Jeremy


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to