Hi,<br><br>To reproduce the scene of send blocking, there must be more than two<div>subrequest, and the more the better.</div><div><br></div><div>When I encounter this problem, my config is as follows (roughly):</div>
<style type="text/css">p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px STHeiti; color: #313131; -webkit-text-stroke: #313131}
span.s1 {font-kerning: none}
</style>
<div>slice 1M;</div><div>limit_rate 2M;</div><div>proxy_buffering on</div><div>proxy_buffer_size 32K;</div><div>proxy_buffers 4 64K;</div><div>proxy_pass http://domain/uri;</div><div><br></div><div>And my system:</div><div>Linux ** 2.6.32-642.13.1.el6.x86_64 #1 SMP Wed Jan 11 20:56:24</div><div>UTC 2017 x86_64 x86_64 x86_64 GNU/Linux</div><div><br></div><div>Patchs bellow:</div><div><br># HG changeset patch<br># User hucongcong <hucong.c@foxmail.com><br># Date 1487298087 -28800<br># Fri Feb 17 10:21:27 2017 +0800<br># Node ID 37b376790ecf83eaaff2f024eb3093a079091d93<br># Parent 05fd0dc8f0dc808219f727dd18a5da2f078c4073<br>Upstream: clear the delayed flag to prevent blocking from sending.<br><br>Suppose that proxy_buffering is on and limit_rate is defined, the send will be<br>blocked in write filter when the following two conditions are met: First, the<br>previous upstream request sets the write->delayed flag and starts the timer of<br>downstream, and then finalized. Second, the timer timed out before the next<br>subrequest enters the function ngx_http_upstream_send_response(), which means<br>the delayed flag is not be cleared properly. Thus, the data transmission from<br>upstream to downstream will be blocked in subrequest.<br><br>By clearing the delayed flag of c->write in ngx_http_upstream_send_response()<br>when the timer of write event is deleted, to solve this problem.<br><br>diff -r 05fd0dc8f0dc -r 37b376790ecf src/http/ngx_http_upstream.c<br>--- a/src/http/ngx_http_upstream.c Thu Feb 16 18:37:22 2017 +0300<br>+++ b/src/http/ngx_http_upstream.c Fri Feb 17 10:21:27 2017 +0800<br>@@ -2848,6 +2848,10 @@ ngx_http_upstream_send_response(ngx_http<br> <br> c = r->connection;<br> <br>+ if (c->write->delayed && !c->write->timer_set) {<br>+ c->write->delayed = 0;<br>+ }<br>+<br> if (r->header_only) {<br> <br> if (!u->buffering) {</div>