Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MB-3856 - SERVER_ERROR proxy downstream timeout $HOST

The $HOST is only appended during timeout of single-server commands
(get, set, delete, etc) which are the single-key commands.  Broadcast
commands (like flush_all) won't have the $HOST appended during a
timeout.

Change-Id: I40c307a2ea4974aca6b884054da1f935ea8216a4
Reviewed-on: http://review.membase.org/6315
Reviewed-by: Bin Cui <bin.cui@gmail.com>
Tested-by: Steve Yen <steve.yen@gmail.com>
  • Loading branch information...
commit 36fe280e0c3fd75da2ecc2f26bb130f9284b25dd 1 parent 75e41c2
@steveyen steveyen authored
Showing with 25 additions and 4 deletions.
  1. +22 −1 cproxy.c
  2. +3 −3 t/moxi_mock_server.py
View
23 cproxy.c
@@ -745,6 +745,8 @@ void cproxy_on_close_downstream_conn(conn *c) {
s = strchr(s, ':'); // Clip to avoid sending user/pswd.
if (s != NULL) {
+ *s++ = '\r';
+ *s++ = '\n';
*s = '\0';
}
}
@@ -2681,7 +2683,26 @@ void downstream_timeout(const int fd,
ptd->stats.stats.tot_downstream_timeout++;
}
- propagate_error_msg(d, "SERVER_ERROR proxy downstream timeout\r\n",
+ char *m = "SERVER_ERROR proxy downstream timeout\r\n";
+
+ if (d->target_host_ident != NULL) {
+ m = add_conn_suffix(d->upstream_conn);
+ if (m != NULL) {
+ snprintf(m, SUFFIX_SIZE - 1,
+ "SERVER_ERROR proxy downstream timeout %s\r\n",
+ d->target_host_ident);
+ m[SUFFIX_SIZE - 1] = '\0';
+
+ char *s = strchr(m, ':'); // Clip to avoid sending user/pswd.
+ if (s != NULL) {
+ *s++ = '\r';
+ *s++ = '\n';
+ *s = '\0';
+ }
+ }
+ }
+
+ propagate_error_msg(d, m,
PROTOCOL_BINARY_RESPONSE_EBUSY);
int n = mcs_server_count(&d->mst);
View
6 t/moxi_mock_server.py
@@ -184,13 +184,13 @@ def mock_send(self, what, session_idx=0):
session.client.send(what)
def client_recv(self, what, idx=0, num_bytes=1024):
- debug(1, "client_recv expect: " + what)
+ debug(1, "client_recv expect: '" + what + "'")
s = self.clients[idx].recv(num_bytes)
- debug(1, "client_recv actual: " + s);
+ debug(1, "client_recv actual: '" + s + "'");
- self.assertTrue(what == s or re.match(what, s) is not None)
+ self.assertTrue(what == s or re.match(what, s))
def mock_session(self, session_idx=0):
wait_max = 5
Please sign in to comment.
Something went wrong with that request. Please try again.