GNU bug report logs - #62044
30.0.50; ERC 5.5: Auto-reconnect is broken

Previous Next

Package: emacs;

Reported by: xoddf2 <woddfellow2 <at> gmail.com>

Date: Wed, 8 Mar 2023 06:14:01 UTC

Severity: normal

Found in version 30.0.50

To reply to this bug, email your comments to 62044 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to emacs-erc <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Wed, 08 Mar 2023 06:14:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to xoddf2 <woddfellow2 <at> gmail.com>:
New bug report received and forwarded. Copy sent to emacs-erc <at> gnu.org, bug-gnu-emacs <at> gnu.org. (Wed, 08 Mar 2023 06:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: xoddf2 <woddfellow2 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Tue, 07 Mar 2023 22:12:53 -0800
Even with the following settings:

(setq erc-server-auto-reconnect t
      erc-server-reconnect-timeout 10
      erc-server-reconnect-attempts t)

ERC does not reconnect to my ZNC bouncer after a network outage.  The
echo area reads "Connecting to example.net:6697..." and "Logging in as
`user'...", but ERC never actually reconnects, even after connectivity
is restored.  The mode line continues to read "(ERC: CLOSED Fly/--)".


In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.36, cairo version 1.16.0) of 2023-03-07, unofficial emacs-snapshot
 build: http://emacs.secretsauce.net built on fatty
Windowing system distributor 'The X.Org Foundation', version 11.0.12101007
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --enable-libsystemd --with-native-compilation
 --with-pop=yes --with-tree-sitter
 --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/30.0.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/30.0.50/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd
 --with-native-compilation --with-pop=yes --with-tree-sitter
 --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/30.0.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/30.0.50/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-imagemagick --with-x-toolkit=gtk3
 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/emacs-snapshot-Vc6LHg/emacs-snapshot-20230307+emacs-28.2-164473-g4e8b50ec57b=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall -fno-omit-frame-pointer'
 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2
M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM
XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: ERC

Minor modes in effect:
  erc-spelling-mode: t
  flyspell-mode: t
  erc-log-mode: t
  erc-autoaway-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-netsplit-mode: t
  erc-ercn-mode: t
  erc-match-mode: t
  erc-hl-nicks-mode: t
  erc-button-mode: t
  erc-stamp-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  erc-networks-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/usr/share/emacs/30.0.50/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-context hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-context
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-contrib hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-contrib
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-server hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-server
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-icalendar hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-icalendar
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-update hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-update
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-main hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-main
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-config hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-config
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-actions hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-actions
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-pkg hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-pkg
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-lists hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-lists
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-helpers hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-helpers
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-bookmarks hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-bookmarks
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-headers hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-headers
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-message hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-message
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-search hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-search
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-compose hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-compose
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-contacts hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-contacts
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-speedbar hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-speedbar
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-folders hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-folders
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-mark hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-mark
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-view hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-view
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-vars hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-vars
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-org hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-org
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-draft hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-draft
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-autoloads hides /usr/share/emacs/site-lisp/elpa/mu4e-1.8.14/mu4e-autoloads
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-context hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-context
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-server hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-server
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-icalendar hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-icalendar
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-main hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-main
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-config hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-config
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-pkg hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-pkg
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-lists hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-lists
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-helpers hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-helpers
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-message hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-message
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-search hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-search
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-compose hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-compose
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-update hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-update
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-speedbar hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-speedbar
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-folders hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-folders
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-headers hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-headers
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-view hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-view
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-vars hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-vars
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-org hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-org
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-contrib hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-contrib
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-actions hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-actions
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-contacts hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-contacts
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-mark hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-mark
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-draft hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-draft
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-autoloads hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-autoloads
/usr/share/emacs/30.0.50/site-lisp/elpa/mu4e-1.8.14/mu4e-bookmarks hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.8.14/mu4e-bookmarks
/home/xoddf2/.emacs.d/elpa/use-package-20230203.2004/use-package-bind-key hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-bind-key
/home/xoddf2/.emacs.d/elpa/bind-key-20230203.2004/bind-key hides /usr/share/emacs/30.0.50/lisp/use-package/bind-key
/home/xoddf2/.emacs.d/elpa/use-package-20230203.2004/use-package-ensure hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-ensure
/home/xoddf2/.emacs.d/elpa/use-package-20230203.2004/use-package-delight hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-delight
/home/xoddf2/.emacs.d/elpa/use-package-20230203.2004/use-package-core hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-core
/home/xoddf2/.emacs.d/elpa/use-package-20230203.2004/use-package-diminish hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-diminish
/home/xoddf2/.emacs.d/elpa/use-package-20230203.2004/use-package-jump hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-jump
/home/xoddf2/.emacs.d/elpa/use-package-20230203.2004/use-package hides /usr/share/emacs/30.0.50/lisp/use-package/use-package
/home/xoddf2/.emacs.d/elpa/use-package-20230203.2004/use-package-lint hides /usr/share/emacs/30.0.50/lisp/use-package/use-package-lint

Features:
(shadow emacsbug cl-print help-fns radix-tree misearch multi-isearch
mule-util display-line-numbers znc advice cl smiley gnus-bcklg
gnus-async qp gnus-ml disp-table mailalias smtpmail textsec uni-scripts
idna-mapping ucs-normalize uni-confusable textsec-check sort gnus-cite
mail-extr nndraft nnmh nnfolder utf-7 network-stream nsm gnus-agent
gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig nntp gnus-cache gnus-sum shr
pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo
gnus-spec gnus-int gnus-range message sendmail yank-media puny dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus nnheader
gnus-util text-property-search mail-utils range mm-util mail-prsvr comp
comp-cstr warnings icons rx rcirc parse-time erc-spelling flyspell
ispell erc-log erc-autoaway ercn erc-list erc-menu erc-join erc-ring
erc-pcomplete pcomplete comint ansi-osc ansi-color ring erc-track
erc-netsplit dash erc-match erc-hl-nicks color erc-button erc-fill
erc-stamp wid-edit erc-goodies erc iso8601 time-date thingatpt pp
format-spec erc-backend erc-networks erc-common erc-compat erc-loaddefs
edmacro kmacro cl-extra help-mode use-package-bind-key bind-key
easy-mmode use-package-ensure use-package-core modus-operandi-theme
modus-vivendi-theme modus-themes finder-inf znc-autoloads ercn-autoloads
erc-hl-nicks-autoloads mu4e-alert-autoloads s-autoloads ht-autoloads
info dash-autoloads package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie generate-lisp-file
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv
bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 1404652 266149)
 (symbols 48 29853 4)
 (strings 32 168672 35742)
 (string-bytes 1 3955639)
 (vectors 16 108362)
 (vector-slots 8 2328169 166965)
 (floats 8 496 169)
 (intervals 56 49583 4814)
 (buffers 984 45))

-- 
xoddf2 | https://wlair.us.to/ | PGP: 20EB90D3




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Wed, 08 Mar 2023 07:57:02 GMT) Full text and rfc822 format available.

Message #8 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: xoddf2 <woddfellow2 <at> gmail.com>
Cc: emacs-erc <at> gnu.org, 62044 <at> debbugs.gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Tue, 07 Mar 2023 23:56:12 -0800
Hi xoddf2,

xoddf2 <woddfellow2 <at> gmail.com> writes:

> Even with the following settings:
>
> (setq erc-server-auto-reconnect t
>       erc-server-reconnect-timeout 10
>       erc-server-reconnect-attempts t)
>
> ERC does not reconnect to my ZNC bouncer after a network outage.  The
> echo area reads "Connecting to example.net:6697..." and "Logging in as
> `user'...", but ERC never actually reconnects, even after connectivity
> is restored.  The mode line continues to read "(ERC: CLOSED Fly/--)".

Thanks for filing this bug. From your comments on Libera, it appears
this problem has been haunting you since at least ERC 5.4 and that it
also occurs with emacs -Q. If either of those is untrue, please correct
the record. For starters, we need to find a recipe, all the way from
emacs -Q, that triggers the unwanted behavior. That way, we can dispense
with any possible complications arising from your init.el and any
third-party packages, e.g.,

> Major mode: ERC
[...]
>   erc-netsplit-mode: t
>   erc-ercn-mode: t
    ^~~~~~~~~~~~~~
>   erc-match-mode: t
>   erc-hl-nicks-mode: t
    ^~~~~~~~~~~~~~~~~
[...]
>
> Features:
> (shadow emacsbug cl-print help-fns radix-tree misearch multi-isearch
> mule-util display-line-numbers znc advice cl smiley gnus-bcklg
                                 ^~~

Also, please be as specific as possible when describing connection
parameters, whether assigned to user options or provided via entry-point
arguments to `erc-tls'. For example, if you give a keyword argument of

  :user "me <at> laptop/libera"

to `erc-tls', please provide something similar in the recipe, rather
than simply

  :user "$user"

And if you use auth-source, please describe the specific back end and,
if possible, the rough contents of any relevant files.

Typically, if we make it to the "Logging in as" phase, we can rule out
TLS- and process-related issues (for now) and instead focus on logical
connection parameters, such as the various `erc-session-foo' variables.
If you don't mind, please do the following before connecting for the
first time in a new -Q session:

  (require 'erc)
  (erc-toggle-debug-irc-protocol) 
  (setq erc-server-reconnect-timeout 60)
  (trace-function-background 'erc--register-connection)
  (trace-function-background 'erc-auth-source-search)
  (trace-function-background 'erc-login)
  (trace-function-background 'erc-open)
  (trace-function-background 'erc-open-network-stream)
  (trace-function-background 'erc-open-tls-stream)
  (trace-function-background 'erc-process-sentinel)
  (trace-function-background 'erc-process-sentinel-1)
  (trace-function-background 'erc-process-sentinel-2)
  (trace-function-background 'erc-schedule-reconnect)
  (trace-function-background 'erc-server-connect)
  (trace-function-background 'erc-server-reconnect)

And, after witnessing the bug, please provide the output of the
*erc-protocol* and *trace-output* buffers (out of band, if necessary,
though ideally with minimal redactions, aside from credentials) along
with the -Q recipe mentioned earlier.

Thanks again,
J.P.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Wed, 08 Mar 2023 09:08:02 GMT) Full text and rfc822 format available.

Message #11 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: xoddf2 <woddfellow2 <at> gmail.com>
To: 62044 <at> debbugs.gnu.org, emacs-erc <at> gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Wed, 08 Mar 2023 01:07:25 -0800
J.P. writes:

> Hi xoddf2,
>
> [...] For starters, we need to find a recipe, all the way from
> emacs -Q, that triggers the unwanted behavior. That way, we can dispense
> with any possible complications arising from your init.el and any
> third-party packages [...]

After running emacs-snapshot -Q, I yanked the below Emacs Lisp code into
the *scratch* buffer, evaluated it, then ran M-x erc.  I left server and
port at default (irc.libera.chat and 6667, respectively), set nick to
aoddf2, and left the server password blank.  I then joined ##test.  I
said something in that channel from my usual client, disconnected the VM
from the network in NetworkManager Applet, and then waited a few
minutes.  I reconnected and then waited again.  ERC had still not
reconnected.

> [...]
>
> Typically, if we make it to the "Logging in as" phase, we can rule out
> TLS- and process-related issues (for now) and instead focus on logical
> connection parameters, such as the various `erc-session-foo' variables.
> If you don't mind, please do the following before connecting for the
> first time in a new -Q session:
>
>   (require 'erc)
>   (erc-toggle-debug-irc-protocol) 
>   (setq erc-server-reconnect-timeout 60)
>   (trace-function-background 'erc--register-connection)
>   (trace-function-background 'erc-auth-source-search)
>   (trace-function-background 'erc-login)
>   (trace-function-background 'erc-open)
>   (trace-function-background 'erc-open-network-stream)
>   (trace-function-background 'erc-open-tls-stream)
>   (trace-function-background 'erc-process-sentinel)
>   (trace-function-background 'erc-process-sentinel-1)
>   (trace-function-background 'erc-process-sentinel-2)
>   (trace-function-background 'erc-schedule-reconnect)
>   (trace-function-background 'erc-server-connect)
>   (trace-function-background 'erc-server-reconnect)
>
> And, after witnessing the bug, please provide the output of the
> *erc-protocol* and *trace-output* buffers (out of band, if necessary,
> though ideally with minimal redactions, aside from credentials) along
> with the -Q recipe mentioned earlier.

*erc-protocol*:

Version: 2
ERC-Version: 5.5
Emacs-Version: 30.0.50
*** This buffer displays all IRC protocol traffic exchanged with servers.
*** Kill it to disable logging.
*** Press t to toggle.*** IRC protocol logging enabled at Wed Mar  8 00:34:44 2023

2023-03-08T00:35:02.020240-0800 irc.libera.chat:6667 >> NICK aoddf2
2023-03-08T00:35:02.020406-0800 irc.libera.chat:6667 >> USER user 0 * :unknown
2023-03-08T00:35:02.161418-0800 irc.libera.chat:6667 << :lead.libera.chat NOTICE * :*** Checking Ident
2023-03-08T00:35:02.469048-0800 irc.libera.chat:6667 << :lead.libera.chat NOTICE * :*** Looking up your hostname...
2023-03-08T00:35:03.186250-0800 irc.libera.chat:6667 << :lead.libera.chat NOTICE * :*** Found your hostname: [REDACTED]
2023-03-08T00:35:08.306391-0800 irc.libera.chat:6667 << :lead.libera.chat NOTICE * :*** No Ident response
2023-03-08T00:35:08.306787-0800 irc.libera.chat:6667 << :lead.libera.chat 001 aoddf2 :Welcome to the Libera.Chat Internet Relay Chat Network aoddf2
2023-03-08T00:35:08.307200-0800 irc.libera.chat:6667 << :lead.libera.chat 002 aoddf2 :Your host is lead.libera.chat[94.125.182.252/6667], running version solanum-1.0-dev
2023-03-08T00:35:08.307887-0800 irc.libera.chat:6667 << :lead.libera.chat 003 aoddf2 :This server was created Thu Nov 24 2022 at 07:37:25 UTC
2023-03-08T00:35:08.308183-0800 irc.libera.chat:6667 << :lead.libera.chat 004 aoddf2 lead.libera.chat solanum-1.0-dev DGIMQRSZaghilopsuwz CFILMPQRSTbcefgijklmnopqrstuvz bkloveqjfI
2023-03-08T00:35:08.308628-0800 lead.libera.chat << :lead.libera.chat 005 aoddf2 FNC WHOX CALLERID=g ETRACE MONITOR=100 KNOCK SAFELIST ELIST=CMNTU CHANTYPES=# EXCEPTS INVEX CHANMODES=eIbq,k,flj,CFLMPQRSTcgimnprstuz :are supported by this server
2023-03-08T00:35:08.309048-0800 lead.libera.chat << :lead.libera.chat 005 aoddf2 CHANLIMIT=#:250 PREFIX=(ov)@+ MAXLIST=bqeI:100 MODES=4 NETWORK=Libera.Chat STATUSMSG=@+ CASEMAPPING=rfc1459 NICKLEN=16 MAXNICKLEN=16 CHANNELLEN=50 TOPICLEN=390 DEAF=D :are supported by this server
2023-03-08T00:35:08.309509-0800 lead.libera.chat << :lead.libera.chat 005 aoddf2 TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR: EXTBAN=$,ajrxz :are supported by this server
2023-03-08T00:35:08.309867-0800 lead.libera.chat << :lead.libera.chat 251 aoddf2 :There are 70 users and 50158 invisible on 28 servers
2023-03-08T00:35:08.310079-0800 lead.libera.chat << :lead.libera.chat 252 aoddf2 37 :IRC Operators online
2023-03-08T00:35:08.310295-0800 lead.libera.chat << :lead.libera.chat 253 aoddf2 41 :unknown connection(s)
2023-03-08T00:35:08.310504-0800 lead.libera.chat << :lead.libera.chat 254 aoddf2 22988 :channels formed
2023-03-08T00:35:08.331744-0800 lead.libera.chat << :lead.libera.chat 255 aoddf2 :I have 3127 clients and 1 servers
2023-03-08T00:35:08.332278-0800 lead.libera.chat << :lead.libera.chat 265 aoddf2 3127 3449 :Current local users 3127, max 3449
2023-03-08T00:35:08.342970-0800 lead.libera.chat << :lead.libera.chat 266 aoddf2 50228 51827 :Current global users 50228, max 51827
2023-03-08T00:35:08.343304-0800 lead.libera.chat << :lead.libera.chat 250 aoddf2 :Highest connection count: 3450 (3449 clients) (314542 connections received)
2023-03-08T00:35:08.343675-0800 lead.libera.chat << :lead.libera.chat 375 aoddf2 :- lead.libera.chat Message of the Day - 
2023-03-08T00:35:08.344067-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :- Welcome to Libera Chat, the IRC network for
2023-03-08T00:35:08.344270-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :- free & open-source software and peer directed projects.
2023-03-08T00:35:08.344460-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :-  
2023-03-08T00:35:08.344615-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :- Use of Libera Chat is governed by our network policies.
2023-03-08T00:35:08.344813-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :-  
2023-03-08T00:35:08.344974-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :- To reduce network abuses we perform open proxy checks
2023-03-08T00:35:08.345192-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :- on hosts at connection time.
2023-03-08T00:35:08.345370-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :-  
2023-03-08T00:35:08.345528-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :- Please visit us in #libera for questions and support.
2023-03-08T00:35:08.345728-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :-  
2023-03-08T00:35:08.345894-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :- Website and documentation:  https://libera.chat
2023-03-08T00:35:08.346100-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :- Webchat:                    https://web.libera.chat
2023-03-08T00:35:08.346305-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :- Network policies:           https://libera.chat/policies
2023-03-08T00:35:08.346508-0800 lead.libera.chat << :lead.libera.chat 372 aoddf2 :- Email:                      support <at> libera.chat
2023-03-08T00:35:08.346694-0800 lead.libera.chat << :lead.libera.chat 376 aoddf2 :End of /MOTD command.
2023-03-08T00:35:08.347303-0800 Libera.Chat >> MODE aoddf2 +i
2023-03-08T00:35:08.347382-0800 Libera.Chat << :aoddf2 MODE aoddf2 :+iw
2023-03-08T00:35:11.908212-0800 Libera.Chat >> JOIN ##test
2023-03-08T00:35:12.348311-0800 Libera.Chat >> PING 1678264512
2023-03-08T00:35:14.914253-0800 Libera.Chat << :aoddf2!~user@[REDACTED] JOIN ##test
2023-03-08T00:35:14.919775-0800 Libera.Chat >> MODE ##test
2023-03-08T00:35:15.268978-0800 Libera.Chat << :lead.libera.chat 353 aoddf2 @ ##test :aoddf2 xoddf2 lonjil2 Guest82707 jstoker
2023-03-08T00:35:15.269737-0800 Libera.Chat << :lead.libera.chat 366 aoddf2 ##test :End of /NAMES list.
2023-03-08T00:35:15.269837-0800 Libera.Chat << :lead.libera.chat PONG lead.libera.chat :1678264512
2023-03-08T00:35:15.678517-0800 Libera.Chat << :lead.libera.chat 324 aoddf2 ##test +Pnst
2023-03-08T00:35:15.679213-0800 Libera.Chat << :lead.libera.chat 329 aoddf2 ##test 1619537078
2023-03-08T00:35:17.932532-0800 Libera.Chat << :xoddf2!~xoddf2 <at> user/xoddf2 PRIVMSG ##test :...
2023-03-08T00:35:42.357025-0800 Libera.Chat >> PING 1678264542
2023-03-08T00:36:12.366140-0800 Libera.Chat >> PING 1678264572
2023-03-08T00:36:42.378078-0800 Libera.Chat >> PING 1678264602
2023-03-08T00:37:12.378084-0800 Libera.Chat >> PING 1678264632

*trace-output*:

======================================================================
1 -> (erc-open "irc.libera.chat" 6667 "aoddf2" "unknown" t nil nil nil nil nil "user" nil)
| 2 -> (erc-auth-source-search :user "aoddf2")
| 2 <- erc-auth-source-search: nil
| 2 -> (erc-server-connect "irc.libera.chat" 6667 #<buffer irc.libera.chat:6667> nil)
| | 3 -> (erc-open-network-stream "erc-irc.libera.chat-6667" nil "irc.libera.chat" 6667)
| | 3 <- erc-open-network-stream: #<process erc-irc.libera.chat-6667>
| 2 <- erc-server-connect: nil
1 <- erc-open: #<buffer irc.libera.chat:6667>
======================================================================
1 -> (erc-process-sentinel #<process erc-irc.libera.chat-6667> "open\n")
| 2 -> (erc--register-connection)
| | 3 -> (erc-login)
| | 3 <- erc-login: nil
| 2 <- erc--register-connection: nil
1 <- erc-process-sentinel: nil
======================================================================
1 -> (erc-auth-source-search :user "##test")
1 <- erc-auth-source-search: nil
======================================================================
1 -> (erc-open "irc.libera.chat" 6667 "aoddf2" "unknown" nil nil (#1="##test") #1# #<process erc-irc.libera.chat-6667> nil "user" nil)
1 <- erc-open: #<buffer ##test>
======================================================================
1 -> (erc-process-sentinel #<process erc-irc.libera.chat-6667> "deleted\n")
| 2 -> (erc-process-sentinel-1 "deleted\n" #<buffer Libera.Chat>)
| | 3 -> (erc-process-sentinel-2 "deleted\n" #<buffer Libera.Chat>)
| | | 4 -> (erc-schedule-reconnect #<buffer Libera.Chat>)
| | | 4 <- erc-schedule-reconnect: [nil 25608 18834 370932 nil erc-server-delayed-reconnect (#<buffer Libera.Chat>) nil 554000 nil]
| | 3 <- erc-process-sentinel-2: nil
| 2 <- erc-process-sentinel-1: nil
1 <- erc-process-sentinel: nil
======================================================================
1 -> (erc-server-reconnect)
| 2 -> (erc-open "irc.libera.chat" 6667 "aoddf2" "unknown" t nil nil nil nil nil "user" nil)
| | 3 -> (erc-server-connect "irc.libera.chat" 6667 #<buffer Libera.Chat> nil)
| | | 4 -> (erc-open-network-stream "erc-irc.libera.chat-6667" nil "irc.libera.chat" 6667)
| | | 4 <- erc-open-network-stream: #<process erc-irc.libera.chat-6667>
| | 3 <- erc-server-connect: nil
| 2 <- erc-open: #<buffer Libera.Chat>
1 <- erc-server-reconnect: nil

(Only redaction was the hostname.)

>
> Thanks again,
> J.P.


-- 
xoddf2 | https://wlair.us.to/ | PGP: 20EB90D3




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Wed, 08 Mar 2023 16:13:02 GMT) Full text and rfc822 format available.

Message #14 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: xoddf2 <woddfellow2 <at> gmail.com>
Cc: emacs-erc <at> gnu.org, 62044 <at> debbugs.gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Wed, 08 Mar 2023 08:12:14 -0800
[Message part 1 (text/plain, inline)]
xoddf2 <woddfellow2 <at> gmail.com> writes:

> J.P. writes:
>
>> Hi xoddf2,
>>
>> [...] For starters, we need to find a recipe, all the way from
>> emacs -Q, that triggers the unwanted behavior. That way, we can dispense
>> with any possible complications arising from your init.el and any
>> third-party packages [...]
>
> After running emacs-snapshot -Q, I yanked the below Emacs Lisp code into
> the *scratch* buffer, evaluated it, then ran M-x erc.  I left server and
> port at default (irc.libera.chat and 6667, respectively), set nick to
> aoddf2, and left the server password blank.  I then joined ##test.  I
> said something in that channel from my usual client, disconnected the VM
> from the network in NetworkManager Applet, and then waited a few
> minutes.  I reconnected and then waited again.  ERC had still not
> reconnected.

Thanks for the logs and the lowdown

As with many things IRC, there are two senses of "connectivity" at play
here with regard to automatic reconnections: network and application. In
your initial report, underlying connectivity is present in some form
because ERC reaches the "Logging in as" stage and attempts to send an
application payload, though there's no telling how far it actually gets.

In your followup, network connectivity is absent due to your
"disconnecting the VM", something confirmed by the logs. While I think
this simulation is worth exploring, we probably shouldn't assume it's
failing in a meaningfully similar way to the real-life connection you're
losing to your bouncer, at least not without trying the settings you
laid out initially and also seeking a better understanding of what the
NM applet is actually doing when you flip the switch.

So to keep things sane, we should probably treat auto-reconnecting
across connectivity gaps as a wishlist item and auto-reconnecting atop
healthy connections as an existing, previously unreported bug. As for
the new feature, I've attached a POC patch that you can try if you're
willing (usage is self-explanatory, but feel free to modify or iterate
as needed). As for the other issue, I think we're going to need some
genuine session logs to really get anywhere. That is, we'll likely need
you to enable logging and tracing during a real session with your
bouncer over a hopefully not-too-prolonged period to capture an actual
reconnect sequence failing. But hold off on that for another round
unless you're feeling adventurous.

Thanks again.

[0001-Add-conditional-erc-server-reconnect-function.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Thu, 09 Mar 2023 02:24:02 GMT) Full text and rfc822 format available.

Message #17 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: xoddf2 <woddfellow2 <at> gmail.com>
Cc: emacs-erc <at> gnu.org, 62044 <at> debbugs.gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Wed, 08 Mar 2023 18:22:47 -0800
[Message part 1 (text/plain, inline)]
"J.P." <jp <at> neverwas.me> writes:

> In your initial report, underlying connectivity is present in some
> form because ERC reaches the "Logging in as" stage and attempts to
> send an application payload,

Actually, this is nonsense (forgive me). I seem to have forgotten that
ERC prints this message regardless of whether a connection attempt
succeeds.

> So to keep things sane, we should probably treat auto-reconnecting
> across connectivity gaps as a wishlist item and auto-reconnecting atop
> healthy connections as an existing, previously unreported bug. As for
> the new feature, I've attached a POC patch that you can try if you're
> willing (usage is self-explanatory, but feel free to modify or iterate
> as needed).

I've attached a less sloppy version that probably still fails in some
common cases, but at least it reuses the existing session connector.

> As for the other issue, I think we're going to need some genuine
> session logs to really get anywhere. That is, we'll likely need you to
> enable logging and tracing during a real session with your bouncer
> over a hopefully not-too-prolonged period to capture an actual
> reconnect sequence failing. But hold off on that for another round
> unless you're feeling adventurous.

Actually, I'm not sure we'll be needing these logs after all. Let's
maybe think on it a bit more (if that's acceptable). Thanks.

[0000-v1-v2.diff (text/x-patch, attachment)]
[0001-Add-conditional-erc-server-reconnect-function.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Thu, 09 Mar 2023 14:39:02 GMT) Full text and rfc822 format available.

Message #20 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: xoddf2 <woddfellow2 <at> gmail.com>
Cc: emacs-erc <at> gnu.org, 62044 <at> debbugs.gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Thu, 09 Mar 2023 06:38:24 -0800
[Message part 1 (text/plain, inline)]
"J.P." <jp <at> neverwas.me> writes:

> I've attached a less sloppy version that probably still fails in some
> common cases, but at least it reuses the existing session connector.

I've improved upon this further (v3 attached) by adding a housekeeping
task to monitor the initial server process from creation. Such a move
may be regrettable because it adds yet more complexity to the already
dizzying auto-reconnect landscape. However, I couldn't find a suitable
way to cover common process errors that aren't presented to the sentinel
but still need to engage the reconnect logic.

If this leads to a futile game of whack-a-mole, we'll obviously need to
try a different approach. But if we do more-or-less build on what I've
got so far, we'll definitely need to ensure it agrees with 27 and 28
before spending serious energy on refinement and tests.

Thanks.

[0000-v2-v3.diff (text/x-patch, attachment)]
[0001-Add-conditional-erc-server-reconnect-function.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Fri, 10 Mar 2023 07:35:02 GMT) Full text and rfc822 format available.

Message #23 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: xoddf2 <woddfellow2 <at> gmail.com>
To: "J.P." <jp <at> neverwas.me>
Cc: emacs-erc <at> gnu.org, 62044 <at> debbugs.gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Thu, 09 Mar 2023 23:34:15 -0800
J.P. writes:

> [...]
>
> I've improved upon this further (v3 attached) by adding a housekeeping
> task to monitor the initial server process from creation. Such a move
> may be regrettable because it adds yet more complexity to the already
> dizzying auto-reconnect landscape. However, I couldn't find a suitable
> way to cover common process errors that aren't presented to the sentinel
> but still need to engage the reconnect logic.
>
> If this leads to a futile game of whack-a-mole, we'll obviously need to
> try a different approach. But if we do more-or-less build on what I've
> got so far, we'll definitely need to ensure it agrees with 27 and 28
> before spending serious energy on refinement and tests.
>
> Thanks.

Version 3 of the patch works, both with an otherwise unconfigured ERC
and with a full configuration connecting to my bouncer.

I used this setting in both cases:
(setq erc-server-reconnect-function 'erc-server-delayed-check-reconnect)

The first 2 versions did not work at all.

Thanks
-- 
xoddf2 | https://wlair.us.to/ | PGP: 20EB90D3




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Sat, 11 Mar 2023 18:53:02 GMT) Full text and rfc822 format available.

Message #26 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: xoddf2 <woddfellow2 <at> gmail.com>
Cc: emacs-erc <at> gnu.org, 62044 <at> debbugs.gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Sat, 11 Mar 2023 10:52:41 -0800
[Message part 1 (text/plain, inline)]
xoddf2 <woddfellow2 <at> gmail.com> writes:

> J.P. writes:
>
>> [...]
>>
>> I've improved upon this further (v3 attached) by adding a housekeeping
>> task to monitor the initial server process from creation. Such a move
>> may be regrettable because it adds yet more complexity to the already
>> dizzying auto-reconnect landscape. However, I couldn't find a suitable
>> way to cover common process errors that aren't presented to the sentinel
>> but still need to engage the reconnect logic.
>>
>> If this leads to a futile game of whack-a-mole, we'll obviously need to
>> try a different approach. But if we do more-or-less build on what I've
>> got so far, we'll definitely need to ensure it agrees with 27 and 28
>> before spending serious energy on refinement and tests.
>>
>> Thanks.
>
> Version 3 of the patch works, both with an otherwise unconfigured ERC
> and with a full configuration connecting to my bouncer.
>
> I used this setting in both cases:
> (setq erc-server-reconnect-function 'erc-server-delayed-check-reconnect)

Really appreciate your trying this out.

> The first 2 versions did not work at all.

Right, and the last one still fails under various (hopefully less
common) conditions, such as an outbound firewall dropping rather than
rejecting packets. But the main problem (IMO) is unneeded complexity,
and that stems from a fundamental design flaw in ERC: initializing new
buffers and mode/module resources before creating connections, hence
resorting to a probe to check for connectivity, which is roundabout and
error prone. But until people become willing to accept the many breaking
changes that a redesign would spell, I'm afraid we're stuck relying on
these unfriendly contortions.

As for next steps, I've polished up this patch some and have marked it
for preliminary inclusion in what will become ERC 5.6.

Thanks again.

[0000-v3-v4.diff (text/x-patch, attachment)]
[0001-5.6-Add-probing-erc-server-reconnect-function-varian.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Mon, 10 Apr 2023 20:26:02 GMT) Full text and rfc822 format available.

Message #29 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: xoddf2 <woddfellow2 <at> gmail.com>
Cc: emacs-erc <at> gnu.org, 62044 <at> debbugs.gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Mon, 10 Apr 2023 13:25:06 -0700
A Libera user was good enough to try this patch and has unfortunately
reported something reminiscent of the old buffer-association troubles
from versions past. According to them, buffers aren't being reused and
new ones are receiving "<n>"-suffixed names. Sadly, this sounds all too
plausible, although they haven't yet furnished a recipe, and I haven't
been able to reproduce anything similar.

Despite this, I've decided to keep things moving and perhaps cast a
wider net by adding these changes to HEAD. Hopefully, this will compel
others to shed more light on the user's account. If all else fails, I
suppose we can consider temporarily changing the default value of
`erc-server-reconnect-function' to enable the new behavior for everyone.
Of course, that runs the risk of annoying disinterested folks while we
work out the kinks. If anyone has something to add here, please share.
Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Mon, 29 Apr 2024 09:57:02 GMT) Full text and rfc822 format available.

Message #32 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: Alexis <flexibeast <at> gmail.com>
To: 62044 <at> debbugs.gnu.org
Cc: emacs-erc <at> gnu.org
Subject: Status update?
Date: Mon, 29 Apr 2024 19:56:02 +1000
i'm also affected by this issue, as a user of the soju 
bouncer. i'm on Emacs 29.3.

i using ERC on my laptop, and my network connection is frequently 
disconnected and reconnected: partly because i'm regularly moving 
around, but also due to occasional dropouts on my home network.

Is there anything i might be able to do to help with this? #29 
says that certain changes have been added to HEAD; should i apply 
those changes and report back what, if anything, i discover?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Fri, 03 May 2024 02:34:02 GMT) Full text and rfc822 format available.

Message #35 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: Alexis <flexibeast <at> gmail.com>
Cc: emacs-erc <at> gnu.org, 62044 <at> debbugs.gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Thu, 02 May 2024 19:32:48 -0700
Hi Alexis,

Alexis <flexibeast <at> gmail.com> writes:

> i'm also affected by this issue, as a user of the soju bouncer. i'm on Emacs
> 29.3.
>
> i using ERC on my laptop, and my network connection is frequently disconnected
> and reconnected: partly because i'm regularly moving around, but also due to
> occasional dropouts on my home network.
>
> Is there anything i might be able to do to help with this? #29 says that
> certain changes have been added to HEAD; should i apply those changes and
> report back what, if anything, i discover?

Yes, please install ERC 5.6 when it's released, which should be any day
now. If you can't wait, you can try out the devel version [1]. Either
way, make sure to customize the option `erc-server-reconnect-function'
to `erc-server-delayed-check-reconnect' before connecting. Note that not
all values of `erc-server-connect-function' are supported. And yes, if
you could report back with any findings, that'd be great.

Thanks,
J.P.

[1] https://elpa.gnu.org/devel/doc/erc.html#Upgrading




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Thu, 09 May 2024 06:15:01 GMT) Full text and rfc822 format available.

Message #38 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: Alexis <flexibeast <at> gmail.com>
To: "J.P." <jp <at> neverwas.me>
Cc: emacs-erc <at> gnu.org, 62044 <at> debbugs.gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Thu, 09 May 2024 16:13:25 +1000
"J.P." <jp <at> neverwas.me> writes:

> Yes, please install ERC 5.6 when it's released, which should be 
> any day
> now. If you can't wait, you can try out the devel version 
> [1]. Either
> way, make sure to customize the option 
> `erc-server-reconnect-function'
> to `erc-server-delayed-check-reconnect' before connecting. Note 
> that not
> all values of `erc-server-connect-function' are supported. And 
> yes, if
> you could report back with any findings, that'd be great.

Ah okay, thanks - i'll keep an eye out for the release, and let 
you know what i find. :-)


Alexis.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Mon, 02 Dec 2024 03:51:02 GMT) Full text and rfc822 format available.

Message #41 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: 62044 <at> debbugs.gnu.org
Cc: emacs-erc <at> gnu.org, xoddf2 <woddfellow2 <at> gmail.com>
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Sun, 01 Dec 2024 19:50:07 -0800
[Message part 1 (text/plain, inline)]
A stop-gap solution for this issue was introduced in ERC 5.6 as
`erc-server-delayed-check-reconnect', a new function value for the
option `erc-server-reconnect-function'. There's since been some
criticism regarding its lack of discoverability, despite it featuring in
the Sample Configuration of ERC's manual. It's therefore been suggested
we favor the behavior it enables whenever possible by detecting
compatible values of `erc-server-connect-function'. Any false negatives
will hopefully only affect advanced users with nonstandard connectors.
The following patch tries to implement this. Feedback welcome.

Thanks.

[0001-5.6.1-Add-smarter-default-for-erc-server-reconnect-f.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Sun, 22 Dec 2024 19:50:02 GMT) Full text and rfc822 format available.

Message #44 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: 62044 <at> debbugs.gnu.org
Cc: emacs-erc <at> gnu.org, xoddf2 <woddfellow2 <at> gmail.com>
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Sun, 22 Dec 2024 11:49:28 -0800
"J.P." <jp <at> neverwas.me> writes:

> A stop-gap solution for this issue was introduced in ERC 5.6 as
> `erc-server-delayed-check-reconnect', a new function value for the
> option `erc-server-reconnect-function'. There's since been some
> criticism regarding its lack of discoverability, despite it featuring in
> the Sample Configuration of ERC's manual. It's therefore been suggested
> we favor the behavior it enables whenever possible by detecting
> compatible values of `erc-server-connect-function'. Any false negatives
> will hopefully only affect advanced users with nonstandard connectors.
> The following patch tries to implement this. Feedback welcome.

I ended up installing this (perhaps only temporarily) as

  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=1c960bda

At the end of the day, I still question the soundness of resorting to a
protocol exchange to prove that the underlying transport is functioning
properly. However, if no one complains in the next week or two, I'll
close this with the release of 5.6.1.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Fri, 27 Dec 2024 23:47:01 GMT) Full text and rfc822 format available.

Message #47 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: 62044 <at> debbugs.gnu.org
Cc: emacs-erc <at> gnu.org, xoddf2 <woddfellow2 <at> gmail.com>
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Fri, 27 Dec 2024 15:46:41 -0800
"J.P." <jp <at> neverwas.me> writes:

> "J.P." <jp <at> neverwas.me> writes:
>
>> A stop-gap solution for this issue was introduced in ERC 5.6 as
>> `erc-server-delayed-check-reconnect', a new function value for the
>> option `erc-server-reconnect-function'. There's since been some
>> criticism regarding its lack of discoverability, despite it featuring in
>> the Sample Configuration of ERC's manual. It's therefore been suggested
>> we favor the behavior it enables whenever possible by detecting
>> compatible values of `erc-server-connect-function'. Any false negatives
>> will hopefully only affect advanced users with nonstandard connectors.
>> The following patch tries to implement this. Feedback welcome.
>
> I ended up installing this (perhaps only temporarily) as
>
>   https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=1c960bda
>
> At the end of the day, I still question the soundness of resorting to a
> protocol exchange to prove that the underlying transport is functioning
> properly. However, if no one complains in the next week or two, I'll
> close this with the release of 5.6.1.

I updated the behavior of `erc-server-delayed-check-reconnect' slightly
so it works without :nowait and reuses the probe connection if possible:

  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=f5ebe47b

One potential problem with the latter approach might be a possible
server-enforced timeout if modules take too long to initialize. In any
case, if anyone finds these changes unsatisfactory, please say so.
Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Thu, 23 Jan 2025 21:00:02 GMT) Full text and rfc822 format available.

Message #50 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: 62044 <at> debbugs.gnu.org
Cc: emacs-erc <at> gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Thu, 23 Jan 2025 12:59:09 -0800
Libera user arjan recently reported an issue involving client certs not
being reused by `erc-server-delayed-check-reconnect', a 5.6 "function
item" for the 5.5 option `erc-server-reconnect-function' that was
introduced in the original change set for this bug. A somewhat related
issue has also surfaced involving the same reconnect function and its
failure to account for bracketed IPv6 addresses when reusing
`erc-session-server'. I've tried to remedy both concerns in:

  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=331bcfae

It would be great if anyone affected by these could try the above
changes. They're also included in the latest ELPA devel snapshot. See
(info "(erc) upgrading") for instructions.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Wed, 05 Feb 2025 19:29:01 GMT) Full text and rfc822 format available.

Message #53 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: Arjan Adriaanse <arjan <at> adriaan.se>
To: "J.P." <jp <at> neverwas.me>
Cc: emacs-erc <at> gnu.org, 62044 <at> debbugs.gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Wed, 05 Feb 2025 20:29:06 +0100
I ported this patch to the 5.6 version available in ELPA and it seems to
fix the client cert issue I had, thank you so much!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Thu, 10 Apr 2025 00:29:02 GMT) Full text and rfc822 format available.

Message #56 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: 62044 <at> debbugs.gnu.org
Cc: emacs-erc <at> gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Wed, 09 Apr 2025 17:28:45 -0700
[Message part 1 (text/plain, inline)]
"J.P." <jp <at> neverwas.me> writes:

> At the end of the day, I still question the soundness of resorting to a
> protocol exchange to prove that the underlying transport is functioning
> properly. However, if no one complains in the next week or two, I'll
> close this with the release of 5.6.1.

This "delayed check" method has reportedly been failing for some users.
It apparently "hangs" at some point while redialing and displays a
negative countdown in the mode line segment. If my suspicions are
correct, this is somewhat of a known issue related to the sending of a
"stateless" pre-connection-registration message, namely a PING, which is
pretty nonstandard for clients.

One possible solution that springs to mind involves reusing the last
session's local state to perform the initial "$hello" of the so-called
"connection registration" sequence. It would interpret any response as
indicative of a healthy connection and stash it in order to first
initialize the session properly before processing the stashed response
manually at the juncture where its request (the "$hello" thing) would
normally be emitted. This solution is appealing in that it would
preserve the program's basic design and contracts. However, its fatal
flaw would be performing connection registration in the old session's
buffer. Doing this hampers modularity by making it difficult if not
impossible for modules to meaningfully influence the process. In any
case, the second of the attached patches (the one labeled "POC") demos
this approach.

For now, I think our best option is to forgo emitting _any_ pre-
registration protocol and to instead accept the "open\n" event from the
process sentinel as sufficient evidence our messages are getting
through. Of course, not seeing a single response means this reconnect
method may still fail with some proxies, which is something I guess
we'll just have to live with. Anyway, the first of the attached patches
(the one labeled "5.6.1") hopefully does this in a competent way. Those
affected by this bug are encouraged to give it a try.

In the end, the fact remains that anything short of fully integrating
the reconnect logic into session setup and the connection-registration
dialog will always be a hack and prone to failure. Unfortunately, such a
comprehensive overhaul would mean reworking the way ERC initializes
sessions and would break way too much user code. But it's something
perhaps worth revisiting on a major version release.

Thanks.

[0001-5.6.1-Don-t-round-trip-auto-reconnect-probe-in-ERC.patch (text/x-patch, attachment)]
[0001-POC-Send-full-erc-login-as-reconnect-probe.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#62044; Package emacs. (Thu, 17 Apr 2025 01:53:01 GMT) Full text and rfc822 format available.

Message #59 received at 62044 <at> debbugs.gnu.org (full text, mbox):

From: "J.P." <jp <at> neverwas.me>
To: 62044 <at> debbugs.gnu.org
Cc: emacs-erc <at> gnu.org
Subject: Re: bug#62044: 30.0.50; ERC 5.5: Auto-reconnect is broken
Date: Wed, 16 Apr 2025 18:52:35 -0700
"J.P." <jp <at> neverwas.me> writes:

> For now, I think our best option is to forgo emitting _any_ pre-
> registration protocol and to instead accept the "open\n" event from the
> process sentinel as sufficient evidence our messages are getting
> through. Of course, not seeing a single response means this reconnect
> method may still fail with some proxies, which is something I guess
> we'll just have to live with. Anyway, the first of the attached patches
> (the one labeled "5.6.1") hopefully does this in a competent way. Those
> affected by this bug are encouraged to give it a try.

I've installed something similar to what was proposed:

  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=c0cb5957

And as mentioned, I'll close this with the release of 5.6.1.




This bug report was last modified 64 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.