CPS-chained subrequests with I/O interceptions no longer work in nginx 0.8.21 (Was Re: Custom event + timer regressions caused by the new release)

agentzh agentzh at gmail.com
Thu Nov 19 07:19:47 MSK 2009

On Tue, Oct 27, 2009 at 6:42 PM, agentzh <agentzh at 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:


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.


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) :)

[1] You can see the patch here:
[2] http://forum.nginx.org/read.php?2,23767

More information about the nginx mailing list