thanks , but now nginx use what to avoid <meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="font-family: 'courier new', monospace; font-size: 13px; border-collapse: collapse; ">subrequests cycle? </span><div>
<font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="border-collapse: collapse;">I think your patch doesn't avoid <span class="Apple-style-span" style="font-size: 13px; ">subrequests cycle, because the certain may call ngx_http_subrequest again finalize request(the newest subrequest), and then cause </span><span class="Apple-style-span" style="font-size: 13px; ">subrequests cycle.</span><br>
</span></font><br></div><div>so i think should remove <span class="Apple-style-span" style="font-family: 'courier new', monospace; font-size: 13px; border-collapse: collapse; ">r->main->subrequests++.</span></div>
<div><font class="Apple-style-span" face="'courier new', monospace"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font><div class="gmail_quote">On Thu, Jul 1, 2010 at 10:08 PM, Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello!<br>
<div><div></div><div class="h5"><br>
On Thu, Jul 01, 2010 at 08:08:42PM +0800, BoBo wrote:<br>
<br>
> hi all.<br>
><br>
> I am reading nginx's source(version is 0.7.66), but i don't understand this<br>
> section:<br>
><br>
> ngx_int_t<br>
> ngx_http_subrequest(ngx_http_request_t *r,<br>
> ngx_str_t *uri, ngx_str_t *args, ngx_http_request_t **psr,<br>
> ngx_http_post_subrequest_t *ps, ngx_uint_t flags)<br>
> {<br>
> ngx_connection_t *c;<br>
> ngx_http_request_t *sr;<br>
> ngx_http_core_srv_conf_t *cscf;<br>
> ngx_http_postponed_request_t *pr, *p;<br>
><br>
> //i know subrequests's default is NGX_HTTP_MAX_SUBREQUESTS + 1 = 51;<br>
> r->main->subrequests--;<br>
><br>
> //when subrequests is 0?<br>
> if (r->main->subrequests == 0) {<br>
> ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,<br>
> "subrequests cycle while processing \"%V\"", uri);<br>
> r->main->subrequests = 1;<br>
> return NGX_ERROR;<br>
> }<br>
> ....................................................................<br>
><br>
> //why subrequests need plus plus?<br>
> r->main->subrequests++;<br>
><br>
> *psr = sr;<br>
><br>
> return ngx_http_post_request(sr);<br>
> }<br>
><br>
> the problem is after call ngx_http_subrequest and r->main->subrequests will<br>
> not change(because subrequests-- and then ++), so when subrequests is 0?<br>
<br>
</div></div>Right now - it would never be 0 (and this strikes badly as long as<br>
you issue > 255 subrequests, as r->main->counter overflows). This<br>
logic was introduced for older subrequest implementation where<br>
subrequests were completed directly. Subrequest processing was<br>
changed in 0.7.25 and this subrequests-- and subrequests++ no<br>
longer make sense.<br>
<br>
I've posted a patch a while ago which moves r->main->subrequests++<br>
into request finalization, see here (in Russian):<br>
<br>
<a href="http://nginx.org/pipermail/nginx-ru/2010-February/032184.html" target="_blank">http://nginx.org/pipermail/nginx-ru/2010-February/032184.html</a><br>
<br>
Maxim Dounin<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<div><div></div><div class="h5"><a href="http://nginx.org/mailman/listinfo/nginx" target="_blank">http://nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>博观约取<br><br>豆瓣:<a href="http://www.douban.com/people/mustang/">www.douban.com/people/mustang/</a><br><br>blog: <a href="http://simohayha.javaeye.com">simohayha.javaeye.com</a><br>
<br>twitter: <a href="http://www.twitter.com/minibobo">www.twitter.com/minibobo</a><br>
</div>