Subject: Re: bug#53070: 27.2; Message "Server closed connection" not verbose enough

From: Robert Pluim <[email-masked]>
Date: Fri, 07 Jan 2022 10:35:14 +0100

>>>>> On Fri, 07 Jan 2022 09:08:28 +0000, Tim Landscheidt <[email-masked]> said:

    Tim> Now "Server closed connection" is an error message defined
    Tim> for IMAP /and/ NNTP servers, and I have configured more than
    Tim> one NNTP server as well.  So I had to set
    Tim> nntp-record-commands to t and look in *nntp-log*'s:

Someone hasn't applied "Robert's rules for debuggability", which
state: "All log messages must be unique" :-)

    Tim> | 20220106T154438.490 news.gmane.io MODE READER
    Tim> | 20220106T154508.531 news.gmane.io *** CONNECTION LOST ***
    Tim> | 20220106T154511.955 news.gmane.io MODE READER
    Tim> | 20220106T154541.984 news.gmane.io *** CALLED nntp-report ***

    Tim> to /assume/ that the error occurs while Gnus is trying to
    Tim> talk to news.gmane.io.

Untested patch below.

    Tim> It would be more helpful if the error message read "Server
    Tim> news.gmane.io closed connection" or, to avoid any ambiguity,
    Tim> "NNTP server news.gmane.io closed connection".

    Tim> (Side note: If such a hiccup happens, it sometimes appears
    Tim> that the *Group* buffer is not updated with regard to number
    Tim> of unread messages per group, etc. for /other/ servers that
    Tim> were successfully contacted.  I don't know if Gnus is more
    Tim> aggressive than it needs to be here; if it encounters an er-
    Tim> ror when trying to contact a POP3 server, it will just ask
    Tim> nicely and continue on.)

Thatʼs a separate issue. My connections are reliable enough that I
donʼt see this.

diff --git i/lisp/gnus/nnimap.el w/lisp/gnus/nnimap.el
index fd6e3c0ccf..710b08b9da 100644
--- i/lisp/gnus/nnimap.el
+++ w/lisp/gnus/nnimap.el
@@ -245,7 +245,7 @@ nnimap-retrieve-headers
 	  (nnimap-header-parameters))
 	 t)
 	(unless (process-live-p (get-buffer-process (current-buffer)))
-	  (error "Server closed connection"))
+	  (error "IMAP server %S closed connection" nnimap-address))
 	(nnimap-transform-headers)
 	(nnheader-remove-cr-followed-by-lf))
       (insert-buffer-substring
diff --git i/lisp/gnus/nntp.el w/lisp/gnus/nntp.el
index 038a6d0625..df4c0068e3 100644
--- i/lisp/gnus/nntp.el
+++ w/lisp/gnus/nntp.el
@@ -305,7 +305,7 @@ nntp-send-string
     (nntp-record-command string))
   (process-send-string process (concat string nntp-end-of-line))
   (or (memq (process-status process) '(open run))
-      (nntp-report "Server closed connection")))
+      (nntp-report "NNTP server %S closed connection" nntp-address)))
 
 (defun nntp-record-command (string)
   "Record the command STRING."
@@ -370,7 +370,7 @@ nntp-wait-for
 	    (nntp-snarf-error-message)
 	    nil))
 	 ((not (memq (process-status process) '(open run)))
-	  (nntp-report "Server closed connection"))
+	  (nntp-report "NNTP server %S closed connection" nntp-address))
 	 (t
 	  (goto-char (point-max))
 	  (let ((limit (point-min))
@@ -1435,7 +1435,7 @@ nntp-accept-process-output
       ;; be the process's former output buffer (i.e. now killed)
       (or (and process
 	       (memq (process-status process) '(open run)))
-          (nntp-report "Server closed connection")))))
+          (nntp-report "NNTP server %S closed connection" nntp-address)))))
 
 (defun nntp-accept-response ()
   "Wait for output from the process that outputs to BUFFER."
@@ -1454,7 +1454,7 @@ nntp-possibly-change-group
   (when group
     (let ((entry (nntp-find-connection-entry nntp-server-buffer)))
       (cond ((not entry)
-             (nntp-report "Server closed connection"))
+             (nntp-report "NNTP server %S closed connection" nntp-address))
             ((not (equal group (caddr entry)))
              (with-current-buffer (process-buffer (car entry))
                (erase-buffer)

Robert
--