Making parallel subrequests in a module

salmaanp nginx-forum at
Tue Sep 17 20:12:12 UTC 2019

I'm trying to make parallel network subrequests in my module. They work
perfectly fine when run sequentially as follows.


return create_subrequest1; ---> (NGX_AGAIN)
return create_subrequest2; ---> (NGX_AGAIN)


To make it parallel, I removed the returns and called NGX_AGAIN twice later
on in the access phase when the subrequests should be done. By doing this
the subrequests are created in parallel and the right handler is called as
well. However, when the second subrequest is finalized, I face an issue
where r!=c->data for the second subrequest and so get this line in the logs

http finalize non-active request: "/<second_subrequest>/?"

So first subrequest is finalized, second subrequest handler is called but
not finalized, parent request finshes and then second subrequest handler
called again and finalized. I don't have the NGX_HTTP_SUBREQUEST_WAITED flag
when calling the subrequest as well.

Anybody who has run into this kind of issue? Any thoughts on how to

- Salmaan

Posted at Nginx Forum:,285639,285639#msg-285639

More information about the nginx mailing list