[PATCH] ngx_event_pipe: add judgment conditions for downstream errors.

Robinson Nie robinsonnie at gmail.com
Mon Jul 30 13:33:11 UTC 2018


Hello!

Here is a patch to solve the following problem: When the proxy is turned
on, if the downstream error (p->output_filter() returns an error), the
current code will still try to read upstream & write downstream, which is
actually unnecessary.


# HG changeset patch

# User dapeng.ndp<dapeng.ndp at alibaba-inc.com>

# Date 1532956361 -28800

#      Mon Jul 30 21:12:41 2018 +0800

# Node ID cbacf180df090540846aefa4a4a5453e307be219

# Parent  f7e79596baf209151682f2f7d220161c034657ac

ngx_event_pipe: add judgment conditions for downstream errors.


Avoid writing downstream & reading upstream, if there is an error due to
writing downstream.


diff -r f7e79596baf2 -r cbacf180df09 src/event/ngx_event_pipe.c

--- a/src/event/ngx_event_pipe.c        Tue Jul 24 18:46:54 2018 +0300

+++ b/src/event/ngx_event_pipe.c        Mon Jul 30 21:12:41 2018 +0800

@@ -247,6 +247,7 @@

             } else if (!p->cacheable

                        && p->downstream->data == p->output_ctx

                        && p->downstream->write->ready

+                       && !p->downstream_error

                        && !p->downstream->write->delayed)

             {

                 /*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20180730/e2c4d9c8/attachment.html>


More information about the nginx-devel mailing list