Issue in Lua-nginx-module when use both ngx.location.capture and ngx.exec

agentzh agentzh at
Thu Apr 7 07:14:21 MSD 2011

2011/3/17 agentzh <agentzh at>:
> I've reproduced it on my side. This is indeed a bug. When ngx.exec()
> is used after ngx.location.capture() or ngx.location.capture_multi(),
> nginx 0.8.11+ will not close the client connection due to leaked
> request reference counter (r->main->count). A hacky work-around is to
> disable nginx http keepalive and rely on the browser (and other http
> clients) to actively close the connection. And that's why wget, curl,
> firefox, and other well-written http clients worked for you.
> Nginx 0.7.68 (and older) is confirmed to work in this context just
> because older nginx does not use reference counting.
> I'll attempt fix in the next few days. Thank you for reporting this
> and sorry about this issue :)

Sorry for the delay. I've caught a really bad cold recently :(

The good news is that I've just fixed this issue in ngx_lua's git HEAD:

Alternatively, you can try out the new release candidate tarball,
which also includes this fix:

Please let me know if it works for you :)

Have fun!

More information about the nginx mailing list