<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div># HG changeset patch</div><div># User FengGu <flygoast@126.com></div><div># Date 1407912835 -28800</div><div>#      Wed Aug 13 14:53:55 2014 +0800</div><div># Node ID 9dd4e38fcce05bcbba4747873a579bc2c9392dd2</div><div># Parent  92490a725fef588939abfe0e1fe89cda0788d02d</div><div>Upstream: avoided directly terminating the connection.</div><div><br></div><div>When memory allocation failed in ngx_http_upstream_cache(), the connection</div><div>would be terminated directly in ngx_http_upstream_init_request().</div><div>Return a INTERNAL_SERVER_ERROR response instead.</div><div><br></div><div>diff -r 92490a725fef -r 9dd4e38fcce0 src/http/ngx_http_upstream.c</div><div>--- a/src/http/ngx_http_upstream.c  Sun Aug 10 17:44:46 2014 +0400</div><div>+++ b/src/http/ngx_http_upstream.c  Wed Aug 13 14:53:55 2014 +0800</div><div>@@ -519,6 +519,11 @@ ngx_http_upstream_init_request(ngx_http_</div><div>             return;</div><div>         }</div><div><br></div><div>+        if (rc == NGX_ERROR) {</div><div>+            ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);</div><div>+            return;</div><div>+        }</div><div>+</div><div>         if (rc != NGX_DECLINED) {</div><div>             ngx_http_finalize_request(r, rc);</div><div>             return;</div></div>