summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2023-04-28 12:50:49 -0700
committerdormando <dormando@rydia.net>2023-04-28 12:52:56 -0700
commit55607161dd04e91b5923ac294cb64bf4f374440f (patch)
tree1d49e9155e7e6bf4109d174f0c93921d8f619682
parent6350e44292a9b72f9b1f9b4dce572903ae2ade14 (diff)
downloadmemcached-55607161dd04e91b5923ac294cb64bf4f374440f.tar.gz
proxy: return 'readvalidate' on be read timeout
New backend connections returned 'conntimeout' whether it timed out establishing the TCP connection or if it died waiting for the "version\r\n" response. Now gives a 'readvalidate' if it's already properly connected.
-rw-r--r--proxy_network.c6
-rw-r--r--t/proxyconfig.t2
2 files changed, 6 insertions, 2 deletions
diff --git a/proxy_network.c b/proxy_network.c
index c95eb89..21da926 100644
--- a/proxy_network.c
+++ b/proxy_network.c
@@ -891,7 +891,11 @@ static void proxy_beconn_handler(const int fd, const short which, void *arg) {
if (which & EV_TIMEOUT) {
P_DEBUG("%s: backend timed out while connecting\n", __func__);
- _reset_bad_backend(be, P_BE_FAIL_CONNTIMEOUT);
+ if (be->connecting) {
+ _reset_bad_backend(be, P_BE_FAIL_CONNTIMEOUT);
+ } else {
+ _reset_bad_backend(be, P_BE_FAIL_READVALIDATE);
+ }
_backend_failed(be);
return;
}
diff --git a/t/proxyconfig.t b/t/proxyconfig.t
index 1f3158a..b71e533 100644
--- a/t/proxyconfig.t
+++ b/t/proxyconfig.t
@@ -168,7 +168,7 @@ my @holdbe = (); # avoid having the backends immediately disconnect and pollute
my @watchable = $watch_s->can_read(5);
is(scalar @watchable, 1, "got new watcher log lines");
- like(<$watcher>, qr/ts=(\S+) gid=\d+ type=proxy_backend error=conntimeout name=\S+ port=11511/, "one backend timed out connecting");
+ like(<$watcher>, qr/ts=(\S+) gid=\d+ type=proxy_backend error=readvalidate name=\S+ port=11511/, "one backend timed out connecting");
like(<$watcher>, qr/ts=(\S+) gid=\d+ type=proxy_backend error=markedbad name=\S+ port=11511/, "backend was marked bad");
for my $msrv (@readable) {