On Tue, Oct 27, 2009 at 6:42 PM, agentzh <agentzh@gmail.com> wrote:
> Okay, more investigation shows that the real problem has nothing to do
> with "sleep", custom events, nor timers. It's the chained subrequest
> model with "I/O interceptions" that no longer works in nginx 0.8.21.
>
Finally, people, finally...I got this issue perfectly sorted out this
early morning :)
I suddenly realized last night that the "last" subrequest's
"post_subrequest" handle should call ngx_http_finalize_request on its
parent handler when the parent handler's content handler returns
anything other than NGX_DONE.
After applying this simple fix [1], the "echo" module passes its whole
test suite against 0.8.21 ~ 0.8.27 as well as all those older versions
>= 0.7.46. Hooray! :D
I've just released "echo" v0.19 which includes this fix:
http://github.com/agentzh/echo-nginx-module/downloads
In retrospect, it was indeed my fault, rather than nginx's. The newer
versions (0.8.21+) just expose my mistakes in chained subrequest
handling :P
Thanks shaun for bringing this issue to me in the other thread [2].
Special thanks go to Marcus Clyne who also cares about this problem
and my "echo" module off-list.
Thanks!
-agentzh
P.S. Lessons learned: when request hangs, first think about potential
lack of ngx_http_finalize_request call (and possible incorrect
r->main->count numbers) :)
References
[1] You can see the patch here:
http://github.com/agentzh/echo-nginx-module/commit/e73092fea78fb3fecc9cdaf0ed84e167b6a169d1
[2] http://forum.nginx.org/read.php?2,23767