Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5xJr-00GBni-Px for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Nov 2023 00:11:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r5xJq-00DawJ-9I for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Nov 2023 00:11:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5xJp-00DavL-Va for pgsql-hackers@lists.postgresql.org; Thu, 23 Nov 2023 00:11:45 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5xJn-007tTy-41 for pgsql-hackers@postgresql.org; Thu, 23 Nov 2023 00:11:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=momjian.us; s=2023062407; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description; bh=2a5IEnkvqAuQ6sISnYtwWQrw6xyOqB2kREfIqn7a7Zo=; b=SKc/p SOk1XMvnB309E29FcQNGit9YG13VF5bg/jNHgHMFYpVy/LGNCXElZV1qQnGfCcW+dhhChmsrkPtqv 2ErECMh5HWsTR+zaljnzyUcv/frDKNgSBlWhtlLD9nhP7Yc2zG9Q9fP0j1++nNSl4tSuWg4U4Sk3V s8UFm7AQQwk5mvKHWk6XcuufhB7aSS5sqRLifhs8+MrI9w9ZZmci5UChZ/b8wXWKOS8h5ivA4ej6x l/QZ03rnreCSNrkCGags5QrFVKZzQZYHaSZwV1cpWuYJk/e5SsQAJZ7oxJhSHYIwq/Tbc7RfzG5Dx +Ap0LUNFMQ7o8RgtPwo6ORaUlzHEg==; Received: from bruce by momjian.us with local (Exim 4.96) (envelope-from ) id 1r5xJl-00BhCa-1f; Wed, 22 Nov 2023 19:11:41 -0500 Date: Wed, 22 Nov 2023 19:11:41 -0500 From: Bruce Momjian To: Tom Lane Cc: Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: [HACKERS] psql casts aspersions on server reliability Message-ID: References: <15946.1475068481@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="VyF6ozbxCJdkZJ9/" Content-Disposition: inline In-Reply-To: <15946.1475068481@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --VyF6ozbxCJdkZJ9/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Sep 28, 2016 at 09:14:41AM -0400, Tom Lane wrote: > Robert Haas writes: > > psql tends to do things like this: > > rhaas=# select * from pg_stat_activity; > > FATAL: terminating connection due to administrator command > > server closed the connection unexpectedly > > This probably means the server terminated abnormally > > before or while processing the request. > > > Basically everything psql has to say about this is a lie: > > I cannot get terribly excited about this. What you seem to be proposing > is that psql try to intuit the reason for connection closure from the > last error message it got, but that seems likely to lead to worse lies > than printing a boilerplate message. > > I could go along with just dropping the last sentence ("This probably...") > if the last error we got was FATAL level. I don't find "unexpectedly" > to be problematic here: from the point of view of psql, and probably > of its user, the shutdown *was* unexpected. I looked at this thread from 2016 and I think the problem is the "abnormally" word, since if the server was shutdown by the administrator (most likely), it isn't abnormal. Here is a patch to remove "abnormally". -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you. --VyF6ozbxCJdkZJ9/ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="exit.diff" diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index 660cdec93c..634708d716 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -749,7 +749,7 @@ retry4: */ definitelyEOF: libpq_append_conn_error(conn, "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" + "\tThis probably means the server terminated\n" "\tbefore or while processing the request."); /* Come here if lower-level code already set a suitable errorMessage */ diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c index f1192d28f2..115776ce6c 100644 --- a/src/interfaces/libpq/fe-secure-openssl.c +++ b/src/interfaces/libpq/fe-secure-openssl.c @@ -206,7 +206,7 @@ rloop: if (result_errno == EPIPE || result_errno == ECONNRESET) libpq_append_conn_error(conn, "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" + "\tThis probably means the server terminated\n" "\tbefore or while processing the request."); else libpq_append_conn_error(conn, "SSL SYSCALL error: %s", @@ -306,7 +306,7 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len) result_errno = SOCK_ERRNO; if (result_errno == EPIPE || result_errno == ECONNRESET) libpq_append_conn_error(conn, "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" + "\tThis probably means the server terminated\n" "\tbefore or while processing the request."); else libpq_append_conn_error(conn, "SSL SYSCALL error: %s", diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index bd72a87bbb..b972bd3ced 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -233,7 +233,7 @@ pqsecure_raw_read(PGconn *conn, void *ptr, size_t len) case EPIPE: case ECONNRESET: libpq_append_conn_error(conn, "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" + "\tThis probably means the server terminated\n" "\tbefore or while processing the request."); break; @@ -395,7 +395,7 @@ retry_masked: /* (strdup failure is OK, we'll cope later) */ snprintf(msgbuf, sizeof(msgbuf), libpq_gettext("server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" + "\tThis probably means the server terminated\n" "\tbefore or while processing the request.")); /* keep newline out of translated string */ strlcat(msgbuf, "\n", sizeof(msgbuf)); --VyF6ozbxCJdkZJ9/--