InterLinked1 / lbbs

Lightweight BBS For Linux - Bulletin Board System server software
GNU General Public License v2.0
35 stars 4 forks source link

mod_sysop: Segmentation fault on shutdown #12

Closed InterLinked1 closed 1 year ago

InterLinked1 commented 1 year ago

If any remote consoles are active at shutdown, any attempts to shutdown or restart (whether from the foreground or a remote console) will cause a segfault during module unload. No segfault when replicated with valgrind.

This is likely more serious memory corruption since there appears to be stack corruption in the backtrace, no further details are available:

Other threads appear to be all right, which is a strong hint this is corruption caused when trying to unload mod_sysop. Possibly related to recent changes to try to move away from pthread_cancel in that module and some others?

Thread 1 (Thread 0x7f99cdffb6c0 (LWP 88031)):
#0  0x00007f99f0401a2a in  ()
#1  0x00007f99d8001270 in  ()
#2  0x0000002000000020 in  ()
#3  0x7900000000000000 in  ()
#4  0x0001003b00000020 in  ()
#5  0x0000000000000020 in  ()
#6  0x26bdeb69d0b5d354 in  ()
#7  0x00007f99cdffabc0 in  ()
#8  0x00007f99d80012c0 in  ()
#9  0x00007f99eaffc850 in  ()
#10 0x00007f99cd7fb000 in  ()
#11 0x26bdeb69d435d354 in  ()
#12 0x26bd9016a3e1d354 in  ()
#13 0x0000000000000000 in  ()
InterLinked1 commented 1 year ago

May or may not be related, but logging can also get stuck here due to write blocking forever:

RWLIST_RDLOCK(&remote_log_fds);
RWLIST_TRAVERSE(&remote_log_fds, rfd, entry) {
    if (fd_logging[rfd->fd]) {
        write(rfd->fd, fullbuf, (size_t) bytes);
    }
}
RWLIST_UNLOCK(&remote_log_fds);