irssi / scripts.irssi.org

Script Repository for Irssi
https://scripts.irssi.org
492 stars 234 forks source link

[tmux-nicklist-portable.pl] - print() on closed filehandle $fifo at line 213 #882

Open needless opened 1 month ago

needless commented 1 month ago

This issue is not easy to reproduce so I try to explain the running environment first and when this issue specifically occurs. The running environment is:

Irssi v1.4.5

The running state is the IRC user session has been active for a long time (days/weeks). IRC connection drops and ZNC finished authenticating successfully.

After attaching the running tmux session the status logs writes following:

print() on closed filehandle $fifo at /home/needle/.irssi/scripts/autorun/tmux-nicklist-portable.pl line 213.
print() on closed filehandle $fifo at /home/needle/.irssi/scripts/autorun/tmux-nicklist-portable.pl line 213.
print() on closed filehandle $fifo at /home/needle/.irssi/scripts/autorun/tmux-nicklist-portable.pl line 213.
print() on closed filehandle $fifo at /home/needle/.irssi/scripts/autorun/tmux-nicklist-portable.pl line 213.

This does not happen when starting a new tmux session.

I try if it is possible to reproduce this without using ZNC. irssi directly connected to IRC network and needs to re-authenticate due to connection loss to IRC.

needless commented 1 month ago

Add running irrsi scripts:

ls .irssi/scripts/autorun -1
adv_windowlist.pl
chansort_configurable.pl
nickcolor_expando_simple.pl
nm2.pl
recentdepart.pl
scriptassist.pl
spellcheck.pl
tmux-nicklist-portable.pl
tmux_away.pl
trackbar.pl
usercount.pl

Irssi running plugin versions:

|12:24 >> Please wait...
│12:24 ,--[ScriptAssist]
│12:24 | o adv_windowlist           Up to date. (1.11)
│12:24 | o chansort_configurable    Up to date. (1.2)
│12:24 | o nickcolor_expando_simple Up to date. (0.0.2)
│12:24 | o nm2                      Up to date. (2.1)
│12:24 | o recentdepart             Up to date. (0.7)
│12:24 | o scriptassist             Up to date. (2023111700)
│12:24 | o spellcheck               Up to date. (0.9.1)
│12:24 | o tmux-nicklist-portable   Up to date. (0.1.8)
│12:24 | o tmux_away                Up to date. (2.1)
│12:24 | o trackbar                 Up to date. (2.9)
│12:24 | o usercount                Up to date. (1.20)
│12:24 `--<check>->

Add running Perl version:

perl -V
Summary of my perl5 (revision 5 version 40 subversion 0) configuration:

  Platform:
    osname=linux
    osvers=6.1.90-0-lts
    archname=armv8l-linux-thread-multi-64int
    uname='linux build-edge-armv7 6.1.90-0-lts #1-alpine smp mon, 06 may 2024 08:14:42 +0000 armv8l linux '
    config_args='-des -Dcccdlflags=-fPIC -Dccdlflags=-rdynamic -Dprefix=/usr -Dprivlib=/usr/share/perl5/core_perl -Darchlib=/usr/lib/perl5/core_perl -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5/vendor_perl -Dvendorarch=/usr/lib/perl5/vendor_perl -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5/site_perl -Dsitearch=/usr/local/lib/perl5/site_perl -Dlocincpth=  -Doptimize=-Os -fstack-clash-protection -Wformat -Werror=format-security -O2 -Duselargefiles -Dusethreads -Duseshrplib -Dd_semctl_semun -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dinstallman1dir=/usr/share/man/man1 -Dinstallman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm -Dcf_by=Alpine -Ud_csh -Ud_fpos64_t -Ud_off64_t -Dusenm -Duse64bitint'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=undef
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
  Compiler:
    cc='cc'
    ccflags ='-D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    optimize='-Os -fstack-clash-protection -Wformat -Werror=format-security -O2'
    cppflags='-D_REENTRANT -D_GNU_SOURCE -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong'
    ccversion=''
    gccversion='13.2.1 20240309'
    gccosandvers=''
    intsize=4
    longsize=4
    ptrsize=4
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=8
    longdblkind=0
    ivtype='long long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/lib /usr/local/lib /lib
    libs=-lpthread -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
    libc=/usr/lib/libc.a
    so=so
    useshrplib=true
    libperl=libperl.so
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/core_perl/CORE'
    cccdlflags='-fPIC'
    lddlflags='-shared -Os -fstack-clash-protection -Wformat -Werror=format-security -O2 -L/usr/local/lib -fstack-protector-strong'

Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_LONG_DOUBLE
    HAS_STRTOLD
    HAS_TIMES
    MULTIPLICITY
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_HASH_FUNC_SIPHASH13
    PERL_HASH_USE_SBOX32
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_SAFE_PUTENV
    USE_64_BIT_INT
    USE_ITHREADS
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
    USE_REENTRANT_API
    USE_THREAD_SAFE_LOCALE
  Built under linux
  Compiled at Jun 25 2024 08:47:07
  %ENV:
    PERL_LWP_SSL_VERIFY_HOSTNAME="0"
  @INC:
    /usr/local/lib/perl5/site_perl
    /usr/local/share/perl5/site_perl
    /usr/lib/perl5/vendor_perl
    /usr/share/perl5/vendor_perl
    /usr/lib/perl5/core_perl
    /usr/share/perl5/core_perl
needless commented 1 month ago

Debugging the plugins settings in the IRC channel, with Koffa. Relevant part of conversation:

 I was just looking at the signals it hooks up to and one is for switching windows. if tmux_away goes to its default window at the right time the fifo might not yet exist? 
/set tmux_away_window   ...  maybe setting tmux_away_grace to a few seconds could avoid the race? 

Before changing:

/set tmux_away
[misc]
                 tmux_away_active ON
                  tmux_away_grace 0
                tmux_away_message Catching ZZz's
                   tmux_away_nick 
                 tmux_away_repeat 180
                 tmux_away_window 1

Setting the tmux_away_grace to 5. /set tmux_away_grace 5

[misc]
                  tmux_away_grace 5