TS-1492 Prevent net-throttling from locking out the health checks from traffic_cop.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c0565072 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c0565072 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c0565072 Branch: refs/heads/3.3.x Commit: c0565072e37db84d033ee00c250b397456a87828 Parents: ca6803a Author: Bin Chen <kuotai at taobao dot com> Authored: Mon Jun 3 11:31:48 2013 -0600 Committer: Leif Hedstrom <[email protected]> Committed: Mon Jun 3 11:31:48 2013 -0600 ---------------------------------------------------------------------- iocore/net/I_NetProcessor.h | 1 + iocore/net/P_NetAccept.h | 1 + iocore/net/UnixNetAccept.cc | 5 +++-- iocore/net/UnixNetProcessor.cc | 2 ++ proxy/http/HttpProxyServerMain.cc | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c0565072/iocore/net/I_NetProcessor.h ---------------------------------------------------------------------- diff --git a/iocore/net/I_NetProcessor.h b/iocore/net/I_NetProcessor.h index 80f6882..fc26468 100644 --- a/iocore/net/I_NetProcessor.h +++ b/iocore/net/I_NetProcessor.h @@ -72,6 +72,7 @@ public: /// Are frequent accepts expected? /// Default: @c false. bool frequent_accept; + bool backdoor; /// Socket receive buffer size. /// 0 => OS default. http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c0565072/iocore/net/P_NetAccept.h ---------------------------------------------------------------------- diff --git a/iocore/net/P_NetAccept.h b/iocore/net/P_NetAccept.h index 3608237..dcb7892 100644 --- a/iocore/net/P_NetAccept.h +++ b/iocore/net/P_NetAccept.h @@ -89,6 +89,7 @@ struct NetAccept:public Continuation AcceptFunctionPtr accept_fn; int ifd; bool callback_on_open; + bool backdoor; Ptr<NetAcceptAction> action_; int recv_bufsize; int send_bufsize; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c0565072/iocore/net/UnixNetAccept.cc ---------------------------------------------------------------------- diff --git a/iocore/net/UnixNetAccept.cc b/iocore/net/UnixNetAccept.cc index 8ad6e6e..0136157 100644 --- a/iocore/net/UnixNetAccept.cc +++ b/iocore/net/UnixNetAccept.cc @@ -284,7 +284,7 @@ NetAccept::do_blocking_accept(EThread * t) // Throttle accepts - while (check_net_throttle(ACCEPT, now)) { + while (!backdoor && check_net_throttle(ACCEPT, now)) { check_throttle_warning(); if (!unix_netProcessor.throttle_error_message) { safe_delay(NET_THROTTLE_DELAY); @@ -386,7 +386,7 @@ NetAccept::acceptFastEvent(int event, void *ep) int loop = accept_till_done; do { - if (check_net_throttle(ACCEPT, ink_get_hrtime())) { + if (!backdoor && check_net_throttle(ACCEPT, ink_get_hrtime())) { ifd = -1; return EVENT_CONT; } @@ -539,6 +539,7 @@ NetAccept::NetAccept() alloc_cache(0), ifd(-1), callback_on_open(false), + backdoor(false), recv_bufsize(0), send_bufsize(0), sockopt_flags(0), http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c0565072/iocore/net/UnixNetProcessor.cc ---------------------------------------------------------------------- diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc index 0f4e389..20bfd61 100644 --- a/iocore/net/UnixNetProcessor.cc +++ b/iocore/net/UnixNetProcessor.cc @@ -41,6 +41,7 @@ NetProcessor::AcceptOptions::reset() f_callback_on_open = false; localhost_only = false; frequent_accept = true; + backdoor = false; recv_bufsize = 0; send_bufsize = 0; sockopt_flags = 0; @@ -146,6 +147,7 @@ UnixNetProcessor::accept_internal( na->packet_mark = opt.packet_mark; na->packet_tos = opt.packet_tos; na->etype = opt.etype; + na->backdoor = opt.backdoor; if (na->callback_on_open) na->mutex = cont->mutex; if (opt.frequent_accept) { // true http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c0565072/proxy/http/HttpProxyServerMain.cc ---------------------------------------------------------------------- diff --git a/proxy/http/HttpProxyServerMain.cc b/proxy/http/HttpProxyServerMain.cc index 68edea6..d15ad29 100644 --- a/proxy/http/HttpProxyServerMain.cc +++ b/proxy/http/HttpProxyServerMain.cc @@ -211,6 +211,7 @@ start_HttpProxyServerBackDoor(int port, int accept_threads) opt.accept_threads = accept_threads; opt.localhost_only = true; ha_opt.backdoor = true; + opt.backdoor = true; // The backdoor only binds the loopback interface netProcessor.main_accept(NEW(new HttpAccept(ha_opt)), NO_FD, opt);
