[LBBS-134] net_ssh: Node lingers forever if closed while running ncurses
Nodes can linger around forever while executing ncurses, resulting in threads that never get joined:
[2026-02-23 04:30:59.984] WARNING[3514494]: thread.c:390 __bbs_pthread_join: Thread 3514495 not yet joined after 6137s
[2026-02-23 04:31:02.128] WARNING[3461484]: thread.c:390 __bbs_pthread_join: Thread 3461488 not yet joined after 45862s
[2026-02-23 04:31:02.129] WARNING[3463712]: thread.c:390 __bbs_pthread_join: Thread 3463715 not yet joined after 154827s
[2026-02-23 04:31:04.985] WARNING[3514490]: thread.c:390 __bbs_pthread_join: Thread 3514491 not yet joined after 6512s
[2026-02-23 04:31:04.986] WARNING[3514487]: thread.c:390 __bbs_pthread_join: Thread 3514490 not yet joined after 6142s
[2026-02-23 04:31:04.986] WARNING[3514494]: thread.c:390 __bbs_pthread_join: Thread 3514495 not yet joined after 6142s
[2026-02-23 04:31:07.129] WARNING[3461484]: thread.c:390 __bbs_pthread_join: Thread 3461488 not yet joined after 45867s
[2026-02-23 04:31:07.129] WARNING[3463712]: thread.c:390 __bbs_pthread_join: Thread 3463715 not yet joined after 154832s
[2026-02-23 04:31:09.985] WARNING[3514490]: thread.c:390 __bbs_pthread_join: Thread 3514491 not yet joined after 6517s
Issue confirmed to happen if client is running ncurses and then closes the SSH window:
[2026-03-02 16:58:47.819] DEBUG[192496]: net_ssh.c:896 handle_session: ssh_event_dopoll returned error (Resource temporarily unavailable), closing SSH channel
[2026-03-02 16:58:47.821] DEBUG[192496]: net_ssh.c:996 handle_session: Terminating SSH session
[2026-03-02 16:58:47.822] DEBUG[192496]: thread.c:364 __bbs_pthread_join: Attempting to join thread 139881481156352 (LWP 192497) at net_ssh.c:1021 handle_session()
[2026-03-02 16:58:49.823] WARNING[192496]: net_ssh.c:1021 handle_session: Thread 192497 is not currently waiting to be joined
[2026-03-02 16:58:49.825] DEBUG[192496]: thread.c:392 __bbs_pthread_join: Thread 192497 not yet joined after 2s
# PROTOCOL ELAPSED USER IP ADDRESS RPORT TID SFD FD RFD WFD MST SLV SPY E B ! TRM SZE ANSI SPEED BPS (RPT) SLOW TRM TYPE MENU/PG/LOC.
4 SSH 0:01:44 InterLinked REDACTED 53851 192497 71 73 73 73 74 75 -1 N N 80x24 Yes BrdB 0 0 N xterm main (OSPS)
26 192496 (139881497941760) [0x7f38b2fed700] (detached 0:04:16) ssh_connection started by thread 165430 at net_ssh.c:2144 ssh_listener()
27 192497 (139881481156352) [0x7f38b1feb700] (joinable 0:04:15) bbs_node_handler started by thread 192496 at net_ssh.c:603 shell_request()
28 192498 (139881472763648) [0x7f38b17ea700] (joinable 0:04:15) pty_master started by thread 192497 at pty.c:165 bbs_pty_allocate()
Thread 27 (Thread 0x7f38b17ea700 (LWP 192498) "lbbs"):
#0 0x00007f38e75cda0f in __GI___poll (fds=0x7f38b17e9d60, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
resultvar = 18446744073709551100
sc_cancel_oldtype = 0
#1 0x0000564cf4c18edc in pty_master (varg=0x7f38bc0dadf0) at pty.c:504
#2 0x0000564cf4c2d30d in thread_run (data=0x7f38bc001770) at thread.c:512
Thread 26 (Thread 0x7f38b1feb700 (LWP 192497) "lbbs"):
#0 0x00007f38e75a57e7 in __GI___wait4 (pid=192500, stat_loc=0x0, options=0, usage=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
#1 0x00007f38e489b921 in bbs_ncurses_menu_getopt (node=0x7f38bc0dadf0, menu=0x7f38b1fea3b0) at mod_ncurses.c:453
pfd = {76, 77}
res = 192500
rres = 139881481151280
c = 0 '\000'
term = {c_iflag = 1280, c_oflag = 5, c_cflag = 191, c_lflag = 35377, c_line = 0 '\000', c_cc = "\003\034\177\025\004\000\001\000\021\023\032\000\022\017\027\026", '\000' <repeats 15 times>, c_ispeed = 15, c_ospeed = 15}
__func__ = "bbs_ncurses_menu_getopt"
#2 0x00007f38d44d1b2c in select_call (agent=0x7f38c8011150) at mod_asterisk_queues.c:990
Thread 25 (Thread 0x7f38b2fed700 (LWP 192496) "lbbs"):
#2 0x0000564cf4c2cd66 in __bbs_pthread_join (thread=139881481156352, retval=0x0, file=0x7f38e4398030 "net_ssh.c", func=0x7f38e43996c8 <__func__.18> "handle_session", line=1021) at thread.c:398
diff = 102
ts = {tv_sec = 1772488834, tv_nsec = 867518814}
start = 1772488727
tmp = 0x7f38e4349160
res = 110
x = 0x7f38c800c970
lwp = 192497
waiting_join = 0
__func__ = "__bbs_pthread_join"
#3 0x00007f38e4393ebc in handle_session (event=0x7f38bc05e4e0, session=0x7f38c8014140) at net_ssh.c:1021Comments
You must be logged in to leave a comment.