From: Martin Schwenke Date: Fri, 5 Oct 2018 04:04:18 +0000 (+1000) Subject: ctdbd_conn: Generalise inaccurate error message X-Git-Tag: tdb-1.3.17~1452 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6784ff24b8a31b9d597d24cab6e34feea2b83e29;p=thirdparty%2Fsamba.git ctdbd_conn: Generalise inaccurate error message Seeing: ctdb_read_packet failed: Cannot allocate memory [..., 0] ../source3/lib/ctdbd_conn.c:121(cluster_fatal) cluster fatal event: ctdbd died The error is due to a memory allocation failure rather than ctdbd dying. However, the error message makes people wonder why ctdbd died. Another alternative would be to wrap cluster_fatal() and have the wrapper interpret the return value from ctdb_read_packet() to choose from a set of more precise messages to pass to cluster_fatal(). For a memory allocation it isn't strictly necessary to call cluster_fatal(), but all is probably lost and it is still probably better to try to exit cleanly as soon as possible instead of crashing somewhere. Signed-off-by: Martin Schwenke Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Fri Oct 5 16:16:29 CEST 2018 on sn-devel-144 --- diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index dc6aa282316..d5fac572d3c 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -405,8 +405,8 @@ static int ctdb_read_req(struct ctdbd_connection *conn, uint32_t reqid, ret = ctdb_read_packet(conn->fd, conn->timeout, mem_ctx, &hdr); if (ret != 0) { - DEBUG(0, ("ctdb_read_packet failed: %s\n", strerror(ret))); - cluster_fatal("ctdbd died\n"); + DBG_ERR("ctdb_read_packet failed: %s\n", strerror(ret)); + cluster_fatal("failed to read data from ctdbd\n"); } DEBUG(11, ("Received ctdb packet\n")); @@ -601,8 +601,8 @@ void ctdbd_socket_readable(struct tevent_context *ev, ret = ctdb_read_packet(conn->fd, conn->timeout, talloc_tos(), &hdr); if (ret != 0) { - DEBUG(0, ("ctdb_read_packet failed: %s\n", strerror(ret))); - cluster_fatal("ctdbd died\n"); + DBG_ERR("ctdb_read_packet failed: %s\n", strerror(ret)); + cluster_fatal("failed to read data from ctdbd\n"); } ret = ctdb_handle_message(ev, conn, hdr); @@ -1082,9 +1082,8 @@ int ctdbd_traverse(struct ctdbd_connection *conn, uint32_t db_id, ret = ctdb_read_packet(conn->fd, conn->timeout, conn, &hdr); if (ret != 0) { - DEBUG(0, ("ctdb_read_packet failed: %s\n", - strerror(ret))); - cluster_fatal("ctdbd died\n"); + DBG_ERR("ctdb_read_packet failed: %s\n", strerror(ret)); + cluster_fatal("failed to read data from ctdbd\n"); } if (hdr->operation != CTDB_REQ_MESSAGE) {