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)
Maxim Dounin
mdounin at mdounin.ru
Tue Oct 27 16:41:13 MSK 2009
Hello!
On Tue, Oct 27, 2009 at 06:42:06PM +0800, agentzh wrote:
> On Tue, Oct 27, 2009 at 5:41 PM, agentzh <agentzh at gmail.com> wrote:
> >
> > Sorry, the failures should be rephrased a bit:
> >
> > "All the regression tests for my "echo" module's echo_sleep directive
> > that is used in subrequests chained by "post_subrequest" callback
> > accepted by ngx_http_subrequest."
> >
>
> 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.
>
> The problem is much easier to phrase in terms of the "echo" module's directives:
>
> location /main {
> echo_location /foo;
> echo_location /sub1;
> }
> location /sub1 {
> proxy_pass 'http://127.0.0.1:$server_port/foo';
> }
> location /foo {
> echo $echo_request_uri;
> }
>
> This is the minimal test case that I can produce. Basically, the
> "post_subrequest" handler for the /foo subrequest issued directly by
> /main issues a subrequest to /sub1. Then /sub1 in turn calls the
> standard proxy module's handler to do some I/O operation. Then the
> whole connection never terminates properly and hangs forever.
>
> If no I/O operation is involved, then the whole request completes
> normally in 0.8.21, no matter it's "echo_sleep" or "proxy_pass" that
> do the actual I/O interception.
>
> The "echo_location" directive and its async friend are defined in the
> following .c file (for total 130+ lines of code only):
>
> http://github.com/agentzh/echo-nginx-module/blob/master/src/location.c
>
> Could anyone give me a handle? :)
Could you please try to produce reduced code that triggers the issue?
I don't really have much time to investigate your module code,
but I believe the problem is that you use subrequests and recall
content handlers in mostly arbitrary way. E.g. it looks like you
call content handler again from post_subrequest handler. This
isn't supposed to work - they are normally called in quite a
different contexts and have very different expectations. Probably
some changes in 0.8.21 rendered your code to be completely
invalid.
Maxim Dounin
More information about the nginx
mailing list