#18447 closed bug (fixed)
TTY: processes stuck polling in tty_select
Reported by: | jessicah | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta5 |
Component: | Drivers/TTY | Version: | R1/beta4 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description
When trying to paste a number of lines of text from clipboard into nano in an ssh session, it's possible for nano & sshd to end up in a live lock situation, not making any progress, apparently in tty_select
.
USER: User command requested kernel debugger. Welcome to Kernel Debugging Land... Thread 237223 "kernel_debugger" running on CPU 0 kdebug> teams team id parent name 0xffffffff830ae600 1 0x0000000000000000 kernel_team 0xffffffff830ac800 235 0xffffffff830ae600 launch_daemon 0xffffffff830af000 239 0xffffffff830ac800 debug_server 0xffffffff830ad200 243 0xffffffff830ac800 mount_server 0xffffffff830ab400 245 0xffffffff830ac800 package_daemon 0xffffffff830adc00 244 0xffffffff830ac800 net_server 0xffffffff830abe00 246 0xffffffff830ac800 power_daemon 0xffffffff830a8c00 247 0xffffffff830ac800 registrar 0xffffffff830a3c00 248 0xffffffff830ac800 syslog_daemon 0xffffffff830a3200 252 0xffffffff830ac800 launch_daemon 0xffffffff9c8edc08 288 0xffffffff830ac800 media_server 0xffffffff9c8ed208 312 0xffffffff830a3200 app_server 0xffffffff9c8ef008 322 0xffffffff830a3200 mail_daemon 0xffffffff9c8eaa08 323 0xffffffff830a3200 Tracker 0xffffffff9c8e9608 329 0xffffffff830a3200 Deskbar 0xffffffff9c8eb408 338 0xffffffff830adc00 sshd 0xffffffff9c8ea008 341 0xffffffff9c8ed208 input_server 0xffffffff9c8ec808 364 0xffffffff9c8edc08 media_addon_server 0xffffffff9c8e0008 86341 0xffffffff9c8eb408 sshd 0xffffffff9c8e3208 86343 0xffffffff9c8e0008 bash 0xffffffff830a1400 236971 0xffffffff9c8e3208 nano 0xffffffff830a1e00 237112 0xffffffff9c8eaa08 Pe 0xffffffff830a0000 237155 0xffffffff9c8eaa08 Terminal 0xffffffff830a0a00 237160 0xffffffff830a0000 bash 0xffffffff9c8e6e08 237223 0xffffffff830a0a00 kernel_debugger kdebug> threads 86341 thread id state wait for object cpu pri stack team name 0xffffffff9d2db480 86341 running - 3 10 0xffffffff82fde00086341 sshd kdebug> threads 236971 thread id state wait for object cpu pri stack team name 0xffffffffcbc18cc0 236971 ready - - 10 0xffffffff94fb1000236971 nano kdebug> sc stack trace for thread 237223 "kernel_debugger" kernel stack: 0xffffffff8202e000 to 0xffffffff82033000 user stack: 0x00007faa3ea03000 to 0x00007faa3fa03000 frame caller <image>:function + offset 0 ffffffff82032938 (+ 32) ffffffff800b3369 <kernel_x86_64> invoke_command_trampoline(void*) + 0x19 1 ffffffff82032958 (+ 24) ffffffff8014707c <kernel_x86_64> arch_debug_call_with_fault_handler + 0x16 2 ffffffff82032970 (+ 80) ffffffff800b0618 <kernel_x86_64> debug_call_with_fault_handler + 0x78 3 ffffffff820329c0 (+ 96) ffffffff800b35cf <kernel_x86_64> invoke_debugger_command + 0xdf 4 ffffffff82032a20 (+ 80) ffffffff800b3767 <kernel_x86_64> invoke_pipe_segment(debugger_command_pipe*, int, char*) + 0x117 5 ffffffff82032a70 (+ 80) ffffffff800b389c <kernel_x86_64> invoke_debugger_command_pipe + 0xac 6 ffffffff82032ac0 (+ 80) ffffffff800b5b16 <kernel_x86_64> ExpressionParser::_ParseCommandPipe(int&) + 0x1e6 7 ffffffff82032b10 (+ 80) ffffffff800b70dd <kernel_x86_64> ExpressionParser::EvaluateCommand(char const*, int&) + 0x43d 8 ffffffff82032b60 (+ 240) ffffffff800b774f <kernel_x86_64> evaluate_debug_command + 0x12f 9 ffffffff82032c50 (+ 96) ffffffff800b1d28 <kernel_x86_64> kernel_debugger_loop(char const*, char const*, __va_list_tag*, int) + 0x198 10 ffffffff82032cb0 (+ 80) ffffffff800b201e <kernel_x86_64> kernel_debugger_internal(char const*, char const*, __va_list_tag*, int) + 0x6e 11 ffffffff82032d00 (+ 544) ffffffff800b26e8 <kernel_x86_64> _user_kernel_debugger + 0x98 12 ffffffff82032f20 (+ 16) ffffffff80148b6f <kernel_x86_64> x86_64_syscall_entry + 0xfb user iframe at 0xffffffff82032f30 (end = 0xffffffff82032ff8) rax 0xe3 rbx 0x20867f7aba0 rcx 0x14664f0cdb9 rdx 0x7faa3fa03658 rsi 0x7faa3fa03648 rdi 0x1ca6a1869e0 rbp 0x7faa3fa01fc0 r8 0x20867f7a788 r9 0x1 r10 0x3 r11 0x246 r12 0x1ca6a1869e0 r13 0x1 r14 0x7faa3fa03658 r15 0x0 rip 0x14664f0cdb9 rsp 0x7faa3fa01fa8 rflags 0x246 vector: 0x63, error code: 0x0 13 ffffffff82032f30 (+140371302346896) 0000014664f0cdb9 <libroot.so> _kern_kernel_debugger + 0x09 14 00007faa3fa01fc0 (+ 48) 000001ca6a18696f <_APP_> _start + 0x3f 15 00007faa3fa01ff0 (+ 48) 0000020867d6cae5 </boot/system/runtime_loader@0x0000020867d5d000> <unknown> + 0xfae5 16 00007faa3fa02020 (+ 0) 00007ffddc91f258 <commpage> commpage_thread_exit + 0x00 kdebug> sc 86341 stack trace for thread 86341 "sshd" kernel stack: 0xffffffff82fde000 to 0xffffffff82fe3000 user stack: 0x00007ffb2fcfe000 to 0x00007ffb30cfe000 frame caller <image>:function + offset 0 ffffffff82fe27d0 (+ 64) ffffffff800798ed <kernel_x86_64> process_pending_ici(int) + 0x13d 1 ffffffff82fe2810 (+ 32) ffffffff8007a407 <kernel_x86_64> smp_intercpu_int_handler + 0x17 2 ffffffff82fe2830 (+ 96) ffffffff80062865 <kernel_x86_64> int_io_interrupt_handler + 0xb5 3 ffffffff82fe2890 (+ 32) ffffffff80152e4b <kernel_x86_64> x86_hardware_interrupt + 0x10b 4 ffffffff82fe28b0 (+ 856) ffffffff8014886c <kernel_x86_64> int_bottom + 0x80 kernel iframe at 0xffffffff82fe2c08 (end = 0xffffffff82fe2cd0) rax 0x1 rbx 0x200 rcx 0xffffffff801cfac8 rdx 0xffffffff8009b796 rsi 0x40fd rdi 0xffffffff82595c10 rbp 0xffffffff82fe2cf0 r8 0x0 r9 0x0 r10 0x3 r11 0x82 r12 0xffffffff82595c00 r13 0xffffffff82595c10 r14 0xffffffffb2131b60 r15 0xffffffffa20a8388 rip 0xffffffff80098307 rsp 0xffffffff82fe2cd8 rflags 0x10286 vector: 0xfd, error code: 0x0 5 ffffffff82fe2c08 (+ 232) ffffffff80098307 <kernel_x86_64> _mutex_unlock + 0x77 6 ffffffff82fe2cf0 (+ 96) ffffffff82592f8c </boot/system/add-ons/kernel/generic/tty> tty_select(tty_cookie*, unsigned char, unsigned int, selectsync*) + 0x6c 7 ffffffff82fe2d50 (+ 96) ffffffff800eb655 <kernel_x86_64> select_fd + 0xe5 8 ffffffff82fe2db0 (+ 128) ffffffff800956f9 <kernel_x86_64> common_poll(pollfd*, unsigned long, long, unsigned long const*, bool) + 0xc9 9 ffffffff82fe2e30 (+ 240) ffffffff80096716 <kernel_x86_64> _user_poll + 0x186 10 ffffffff82fe2f20 (+ 16) ffffffff80148b6f <kernel_x86_64> x86_64_syscall_entry + 0xfb user iframe at 0xffffffff82fe2f30 (end = 0xffffffff82fe2ff8) rax 0x80 rbx 0x7ffb30cfc9e4 rcx 0x93fbd9478c rdx 0xffffffffffffffff rsi 0x4 rdi 0x119ce902cd20 rbp 0x7ffb30cfc6f0 r8 0x7ffb30cfca00 r9 0x0 r10 0x7ffb30cfca00 r11 0x246 r12 0x7ffb30cfc730 r13 0x0 r14 0x7ffb30cfc9f0 r15 0x119ce901e740 rip 0x93fbd9478c rsp 0x7ffb30cfc6d8 rflags 0x246 vector: 0x63, error code: 0x0 11 ffffffff82fe2f30 (+140718929713088) 00000093fbd9478c <libroot.so> _kern_poll + 0x0c 12 00007ffb30cfc6f0 (+ 656) 0000016592fc2ffb <sshd> dump_config (nearest) + 0x2c9b 13 00007ffb30cfc980 (+ 192) 0000016592fc446e <sshd> server_loop2 + 0x2de 14 00007ffb30cfca40 (+ 96) 0000016592fd0988 <sshd> do_authenticated + 0x1b8 15 00007ffb30cfcaa0 (+1712) 0000016592fb2995 <sshd> main + 0x3735 16 00007ffb30cfd150 (+ 48) 0000016592fb38df <sshd> _start + 0x3f 17 00007ffb30cfd180 (+ 48) 0000016c082adae5 </boot/system/runtime_loader@0x0000016c0829e000> <unknown> + 0xfae5 18 00007ffb30cfd1b0 (+ 0) 00007ff81a6e5258 <commpage> commpage_thread_exit + 0x00 kdebug> sc 236971 stack trace for thread 236971 "nano" kernel stack: 0xffffffff94fb1000 to 0xffffffff94fb6000 user stack: 0x00007ffca7ce3000 to 0x00007ffca8ce3000 frame caller <image>:function + offset 0 ffffffff94fb5c00 (+ 112) ffffffff8009bd34 <kernel_x86_64> reschedule(int) + 0x424 1 ffffffff94fb5c70 (+ 48) ffffffff8008b606 <kernel_x86_64> thread_block + 0xc6 2 ffffffff94fb5ca0 (+ 80) ffffffff80097e3a <kernel_x86_64> _mutex_lock + 0x21a 3 ffffffff94fb5cf0 (+ 96) ffffffff82592f6e </boot/system/add-ons/kernel/generic/tty> tty_select(tty_cookie*, unsigned char, unsigned int, selectsync*) + 0x4e 4 ffffffff94fb5d50 (+ 96) ffffffff800eb655 <kernel_x86_64> select_fd + 0xe5 5 ffffffff94fb5db0 (+ 128) ffffffff800956f9 <kernel_x86_64> common_poll(pollfd*, unsigned long, long, unsigned long const*, bool) + 0xc9 6 ffffffff94fb5e30 (+ 240) ffffffff8009677c <kernel_x86_64> _user_poll + 0x1ec 7 ffffffff94fb5f20 (+ 16) ffffffff80148b6f <kernel_x86_64> x86_64_syscall_entry + 0xfb user iframe at 0xffffffff94fb5f30 (end = 0xffffffff94fb5ff8) rax 0x80 rbx 0x7ffca8ce1c00 rcx 0x153d88a978c rdx 0x0 rsi 0x1 rdi 0x7ffca8ce1c00 rbp 0x7ffca8ce1bb0 r8 0x0 r9 0x12023268bc30 r10 0x0 r11 0x206 r12 0x7ffca8ce1c10 r13 0x0 r14 0x0 r15 0x75d12 rip 0x153d88a978c rsp 0x7ffca8ce1b98 rflags 0x206 vector: 0x63, error code: 0x0 8 ffffffff94fb5f30 (+140724936031360) 00000153d88a978c <libroot.so> _kern_poll + 0x0c 9 00007ffca8ce1bb0 (+ 160) 00000064fc6b65e1 <libncursesw.so.6> _nc_timed_wait + 0x121 10 00007ffca8ce1c50 (+ 240) 00000064fc692515 <libncursesw.so.6> _nc_wgetch + 0x875 11 00007ffca8ce1d40 (+ 48) 00000064fc6929cb <libncursesw.so.6> wgetch + 0x2b 12 00007ffca8ce1d70 (+ 80) 00000123843fed78 <nano> read_keys_from + 0x158 13 00007ffca8ce1dc0 (+ 16) 00000123843ff0ea <nano> get_input + 0x5a 14 00007ffca8ce1dd0 (+ 48) 00000123843ff138 <nano> parse_kbinput + 0x28 15 00007ffca8ce1e00 (+ 48) 00000123843ff9e0 <nano> get_kbinput + 0x20 16 00007ffca8ce1e30 (+ 80) 00000123843eb683 <nano> suck_up_input_and_paste_it + 0x83 17 00007ffca8ce1e80 (+ 64) 00000123843ebe3d <nano> process_a_keystroke + 0x3cd 18 00007ffca8ce1ec0 (+1984) 00000123843d8882 <nano> main + 0xe52 19 00007ffca8ce2680 (+ 48) 00000123843d915f <nano> _start + 0x3f 20 00007ffca8ce26b0 (+ 48) 000001b8002a6ae5 </boot/system/runtime_loader@0x000001b800297000> <unknown> + 0xfae5 21 00007ffca8ce26e0 (+ 0) 00007fffff8c1258 <commpage> commpage_thread_exit + 0x00 kdebug>
Change History (10)
comment:2 by , 18 months ago
Can you try to determine which change(s) caused this regression: the most likely culprits are either the TTY/PTY refactor, or the select() modifications; it could be either (or something else entirely, I suppose.)
comment:3 by , 18 months ago
Milestone: | Unscheduled → R1/beta5 |
---|
This sounds annoying enough to deserve a beta5 milestone
comment:4 by , 12 months ago
Are the stack traces accurate and not just random, i.e. is this a deadlock, or just some sort of select problem? #18486 may be related if the latter is the case. Has anyone seen this since then?
comment:5 by , 11 months ago
This still happens on hrev57465, and is super easy to reproduce:
ssh
into Haiku (this is a VM in VirtualBox in this case)nano
into a new or existing file, doesn't matter- paste text into nano, e.g. copying this ticket description and pasting with right-click using PuTTY as ssh client to Haiku
At this point, both nano
and sshd
are stuck in live lock (both consuming CPU).
On hrev57465, using Debugger instead of KDL, the stack traces are slightly different:
Debug information for team /boot/system/bin/sshd (807): CPU(s): 4x Intel Core™ i7-8705G Memory: 11.98 GiB total, 1.17 GiB used Haiku revision: hrev57465 Dec 22 2023 07:02:14 (x86_64) Active Threads: thread 920: team 807 debug task thread 807: sshd (main) state: Debugged Frame IP Function Name ----------------------------------------------- 00000000 0x175fd50db6a _kern_write + 0xa Disassembly: _kern_write: 0x00000175fd50db60: 4989ca mov %rcx, %r10 0x00000175fd50db63: 48c7c095000000 mov $0x95, %rax 0x00000175fd50db6a: 0f05 syscall <-- 0x7fe9d50b8240 0x175fd591c96 write + 0x16 0x7fe9d50b82c0 0x687575b70d /boot/system/bin/sshd + 0x7b70d 0x7fe9d50b8330 0x687575e22f /boot/system/bin/sshd + 0x7e22f 0x7fe9d50b83e0 0x68757154a3 server_loop2 + 0x313 0x7fe9d50b8440 0x6875721983 do_authenticated + 0x1b3 0x7fe9d50b8af0 0x6875703990 main + 0x3730 0x7fe9d50b8b20 0x68757048da _start + 0x3a 0x7fe9d50b8b50 0x19204faaab3 runtime_loader + 0x113 00000000 0x7ffb7f088258 commpage_thread_exit + 0 Registers: rip: 0x00000175fd50db6c rsp: 0x00007fe9d50b8218 rbp: 0x00007fe9d50b8230 rax: 0xffffffff8000000b rbx: 0x000012271abfbab0 rcx: 0x00000175fd50db6c rdx: 0x000012271acaf320 rsi: 0xffffffffffffffff rdi: 0x0000000000000005 r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x000000000000242c r11: 0x0000000000000202 r12: 0x000012271ac35740 r13: 0x00000175fd5eb988 r14: 0x000012271acaf320 r15: 0x000000000000242c cs: 0x002b ds: 0x0000 es: 0x0000 fs: 0x0000 gs: 0x0000 ss: 0x0023 st0: 0 st1: 0 st2: 0 st3: 0 st4: 0 st5: 0 st6: 0 st7: 0 mm0: {0, 0, 0, 0} mm1: {0, 0, 0, 0} mm2: {0, 0, 0, 0} mm3: {0, 0, 0, 0} mm4: {0, 0, 0, 0} mm5: {0, 0, 0, 0} mm6: {0, 0, 0, 0} mm7: {0, 0, 0, 0} ymm0: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm1: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm2: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm3: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm4: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm5: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm6: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm7: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm8: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm9: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm10: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm11: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm12: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm13: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm14: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm15: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} Loaded Images: ID Text Base Text End Data Base Data End Type Name -------------------------------------------------------------------------------- 7177 0x528e75c000 0x528e77b000 0x528e77b000 0x528e77c000 lib /boot/system/lib/libgcc_s.so.1 7171 0x65da8c3000 0x65da8f7000 0x65da8f7000 0x65da901000 lib /boot/system/lib/libnetwork.so 7170 0x68756e0000 0x68757f4000 0x68759f4000 0x68759fe000 app /boot/system/bin/sshd 7174 0x8fa8c3d000 0x8fa8c53000 0x8fa8c53000 0x8fa8c54000 lib /boot/system/lib/libz.so.1.3 7173 0x16da8b1e000 0x16da8d3b000 0x16da8d3b000 0x16da8d6a000 lib /boot/system/lib/libcrypto.so.1.1 7175 0x175fd4ce000 0x175fd5de000 0x175fd5de000 0x175fd5f4000 lib /boot/system/lib/libroot.so 7172 0x183d0367000 0x183d0372000 0x183d0372000 0x183d0373000 lib /boot/system/lib/libbsd.so 7169 0x19204f9b000 0x19204fb8000 0x19204fb8000 0x19204fb9000 lib /boot/system/runtime_loader 7176 0x22be5761000 0x22be5994000 0x22be5994000 0x22be59aa000 lib /boot/system/lib/libstdc++.so.6.0.32 7168 0x7ffb7f088000 0x7ffb7f090000 0x00000000 0x00000000 system commpage Areas: ID Base End Size (KiB) Protection Locking Name -------------------------------------------------------------------------------- 23250 0x528e75c000 0x528e77b000 124 r-x none libgcc_s.so.1_seg0ro 23251 0x528e77b000 0x528e77c000 4 rw- none libgcc_s.so.1_seg1rw 23234 0x65da8c3000 0x65da8f7000 208 r-x none libnetwork.so_seg0ro 23235 0x65da8f7000 0x65da8fa000 12 rw- none libnetwork.so_seg1rw 23236 0x65da8fa000 0x65da901000 28 rw- none libnetwork.so_seg2rw 23231 0x68756e0000 0x68757f4000 1104 r-x none sshd_seg0ro 23232 0x68759f4000 0x68759fa000 24 rw- none sshd_seg1rw 23233 0x68759fa000 0x68759fe000 16 rw- none sshd_seg2rw 23229 0x6a00562000 0x6a00572000 64 rw- none rld heap 23242 0x8fa8c3d000 0x8fa8c53000 88 r-x none libz.so.1.3_seg0ro 23243 0x8fa8c53000 0x8fa8c54000 4 rw- none libz.so.1.3_seg1rw 23230 0xa5e3df4000 0xa5e3df5000 4 rw-cS none _rld_debug_ 23252 0x11bf82cf000 0x11bf82df000 64 rw- none rld heap 23253 0x14be955e000 0x14be956e000 64 rw- none rld heap 23255 0x153b66ba000 0x153b66bb000 4 rw- none sshd mmap area 23256 0x1676eb0a000 0x1676eb0b000 4 rw- none sshd mmap area 23239 0x16da8b1e000 0x16da8d3b000 2164 r-x none libcrypto.so.1.1_seg0ro 23240 0x16da8d3b000 0x16da8d67000 176 rw- none libcrypto.so.1.1_seg1rw 23241 0x16da8d67000 0x16da8d6a000 12 rw- none libcrypto.so.1.1_seg2rw 23244 0x175fd4ce000 0x175fd5de000 1088 r-x none libroot.so_seg0ro 23245 0x175fd5de000 0x175fd5ec000 56 rw- none libroot.so_seg1rw 23246 0x175fd5ec000 0x175fd5f4000 32 rw- none libroot.so_seg2rw 23237 0x183d0367000 0x183d0372000 44 r-x none libbsd.so_seg0ro 23238 0x183d0372000 0x183d0373000 4 rw- none libbsd.so_seg1rw 23227 0x19204f9b000 0x19204fb8000 116 r-x none runtime_loader_seg0ro 23228 0x19204fb8000 0x19204fb9000 4 rw- none runtime_loader_seg1rw 23247 0x22be5761000 0x22be5994000 2252 r-x none libstdc++.so.6.0.32_seg0ro 23248 0x22be5994000 0x22be59a2000 56 rw- none libstdc++.so.6.0.32_seg1rw 23249 0x22be59a2000 0x22be59aa000 32 rw- none libstdc++.so.6.0.32_seg2rw 23254 0x12271abd1000 0x12271bed1000 19456 rw- none heap 23225 0x7fe9d40b5000 0x7fe9d50ba000 16404 rw-s none sshd_807_stack 23224 0x7ff3063d3000 0x7ff3063d7000 16 rw-k full user area 23226 0x7ffb7f088000 0x7ffb7f090000 32 r-xSk full commpage Protection Flags: r - read, w - write, x - execute, s - stack, o - overcommit, c - cloneable, S - shared, k - kernel Semaphores: ID Count Last Holder Name ------------------------------------------------------------
Debug information for team /boot/system/bin/nano (882): CPU(s): 4x Intel Core™ i7-8705G Memory: 11.98 GiB total, 1.17 GiB used Haiku revision: hrev57465 Dec 22 2023 07:02:14 (x86_64) Active Threads: thread 957: team 882 debug task thread 882: nano (main) state: Debugged Frame IP Function Name ----------------------------------------------- 00000000 0x15d21234b4a _kern_read + 0xa Disassembly: _kern_read: 0x0000015d21234b40: 4989ca mov %rcx, %r10 0x0000015d21234b43: 48c7c093000000 mov $0x93, %rax 0x0000015d21234b4a: 0f05 syscall <-- 0x7fdcb9d04d70 0x000001 ? 0x7fdcb9d04e70 0x1e041d89eda _nc_wgetch + 0x23a 0x7fdcb9d04ea0 0x1e041d8a9c6 wgetch + 0x26 0x7fdcb9d04ef0 0x21867e26e43 read_keys_from(WINDOW*) + 0xf3 (/sources/nano-7.2/src/winio.c:-1) Variables: frame: 0x10f9f828c5c0 { _cury: 0 _curx: 0 _maxy: 68 _maxx: 236 _begy: 1 _begx: 0 _flags: 2 _attrs: 0 _bkgd: 0 _notimeout: false _clear: false _leaveok: false _scroll: false _idlok: false _idcok: true _immed: false _sync: false _use_keypad: true _delay: -1 _line: 0x10f9f8295870 _regtop: 0 _regbottom: 68 _parx: -1 _pary: -1 _parent: 0 _yoffset: 0 _bkgrnd _color: 0 } input: 32 0x7fdcb9d04f00 0x21867e271ed get_input(WINDOW*) + 0x4d (/sources/nano-7.2/src/winio.c:-1) Variables: frame: No such file or directory 0x7fdcb9d04f30 0x21867e27245 parse_kbinput(WINDOW*) + 0x25 (/sources/nano-7.2/src/winio.c:-1) Variables: frame: No such file or directory first_escape_was_alone: false last_escape_was_alone: false escapes: 0 0x7fdcb9d04f60 0x21867e279fb get_kbinput(WINDOW*, _Bool) + 0x1b (/sources/nano-7.2/src/winio.c:-1) Variables: frame: 0x10f9f828c5c0 { _cury: 0 _curx: 0 _maxy: 68 _maxx: 236 _begy: 1 _begx: 0 _flags: 2 _attrs: 0 _bkgd: 0 _notimeout: false _clear: false _leaveok: false _scroll: false _idlok: false _idcok: true _immed: false _sync: false _use_keypad: true _delay: -1 _line: 0x10f9f8295870 _regtop: 0 _regbottom: 68 _parx: -1 _pary: -1 _parent: 0 _yoffset: 0 _bkgrnd _color: 0 } kbinput: 0 0x7fdcb9d04fb0 0x21867e137d0 suck_up_input_and_paste_it(void) + 0x80 (/sources/nano-7.2/src/nano.c:-1) Variables: was_cutbuffer: 0 { data: Invalid Argument lineno: Bad address next: Bad address prev: Bad address multidata: Bad address has_anchor: Bad address } line: 0x10f9f82bdbb0 { data: thread id state w 0 0 0 0x 0xffff 0xfffff 0 0 0 0xffffffff9 0xfff 0 0 0 0xffff 0 0xffff 0 0 0xffffffff9c8 0 0 0 0 0xffff 0xffff 0 0 0 0 0xffff 0x 0 0xffff 0 0 0xffff 0 0 0 0xfffff 0xffff 0 0 0xffff 0x 0 0 0 0xffff 0 0xffff 0x 0 0xfff lineno: 271 next: 0x10f9f82bdb70 prev: 0x10f9f82bdbf0 multidata: 0 has_anchor: false } index: 1518 0x7fdcb9d04ff0 0x21867e13fa8 process_a_keystroke(void) + 0x3c8 (/sources/nano-7.2/src/nano.c:-1) Variables: puddle: Invalid Argument capacity: 12 depth: 0 was_mark: 0 { data: Invalid Argument lineno: Bad address next: Bad address prev: Bad address multidata: Bad address has_anchor: Bad address } give_a_hint: true function: 0x21867e0b0e0 was_current: 0x10f9f82938f0 { data: lineno: 1 next: 0 prev: 0 multidata: 0 has_anchor: false } was_x: 0 0x7fdcb9d057b0 0x21867e008a6 re_compile_internal(regex_t*, const char*, size_t, reg_syntax_t) + 0xe86 (/sources/nano-7.2/lib/regex_internal.c:-1) Variables: err: _REG_NOERROR regexp { raw_mbs: Invalid Argument mbs: Bad address wcs: 0x21867e3cd28 offsets: 0 cur_state raw_mbs_idx: 0 valid_len: 0 valid_raw_len: 37 bufs_len: 2303845453451 cur_idx: 0 raw_len: 0 len: 95 raw_stop: 2303845453461 stop: 0 tip_context: 0 trans: Bad address word_char: 0 icase: 0 is_utf8: 0 map_notascii: 0 mbs_allocated: 0 offsets_needed: 0 newline_anchor: 0 word_ops_used: 0 mb_cur_max: 0 } 0x7fdcb9d057d0 0x21867e0118a _start + 0x3a 0x7fdcb9d05810 0x9c89f39ab3 runtime_loader + 0x113 00000000 0x7fff94d0e258 commpage_thread_exit + 0 Registers: rip: 0x0000015d21234b4c rsp: 0x00007fdcb9d04d58 rbp: 0x00007fdcb9d04d70 rax: 0x0000000000000001 rbx: 0x0000000000000000 rcx: 0x0000015d21234b4c rdx: 0x00007fdcb9d04da0 rsi: 0xffffffffffffffff rdi: 0x0000000000000000 r8: 0x0000000000000000 r9: 0x000010f9f8296230 r10: 0x0000000000000001 r11: 0x0000000000000206 r12: 0x0000000000000032 r13: 0x000010f9f82354a0 r14: 0x000010f9f82a03b0 r15: 0x0000021867e4d0f4 cs: 0x002b ds: 0x0000 es: 0x0000 fs: 0x0000 gs: 0x0000 ss: 0x0023 st0: 0 st1: 0 st2: 0 st3: 0 st4: 0 st5: 0 st6: 0 st7: 0 mm0: {0, 0, 0, 0} mm1: {0, 0, 0, 0} mm2: {0, 0, 0, 0} mm3: {0, 0, 0, 0} mm4: {0, 0, 0, 0} mm5: {0, 0, 0, 0} mm6: {0, 0, 0, 0} mm7: {0, 0, 0, 0} ymm0: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm1: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm2: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm3: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm4: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm5: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm6: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm7: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm8: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm9: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm10: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm11: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm12: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm13: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm14: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ymm15: {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} Loaded Images: ID Text Base Text End Data Base Data End Type Name -------------------------------------------------------------------------------- 8218 0x30b6e13000 0x30b6e25000 0x30b6e25000 0x30b6e26000 lib /boot/system/lib/libroot-addon-icu.so 8212 0x69696b3000 0x69696bd000 0x69698bc000 0x69698be000 lib /boot/system/lib/libintl.so.8.3.0 8216 0x93945ca000 0x93946d2000 0x93948d1000 0x93948d4000 lib /boot/system/lib/libiconv.so.2.6.1 8210 0x9c89f2a000 0x9c89f47000 0x9c89f47000 0x9c89f48000 lib /boot/system/runtime_loader 8217 0xfa3a675000 0xfa3a694000 0xfa3a694000 0xfa3a695000 lib /boot/system/lib/libgcc_s.so.1 8222 0x15baf41b000 0x15baf427000 0x15baf626000 0x15baf628000 lib /boot/system/lib/libicuio.so.66.1 8220 0x15bd3d35000 0x15bd3d36000 0x15bd3f35000 0x15bd3f36000 lib /boot/system/lib/libicudata.so.66.1 8215 0x15d211f5000 0x15d21305000 0x15d21305000 0x15d2131b000 lib /boot/system/lib/libroot.so 8221 0x19a5875e000 0x19a58a55000 0x19a58c54000 0x19a58c6d000 lib /boot/system/lib/libicui18n.so.66.1 8223 0x1bd20b24000 0x1bd20cf8000 0x1bd20ef8000 0x1bd20f0e000 lib /boot/system/lib/libicuuc.so.66.1 8213 0x1c4e9694000 0x1c4e96aa000 0x1c4e96aa000 0x1c4e96ab000 lib /boot/system/lib/libz.so.1.3 8214 0x1e041d6a000 0x1e041dd2000 0x1e041fd2000 0x1e041fd7000 lib /boot/system/lib/libncursesw.so.6.3.0 8219 0x1e720fe5000 0x1e721218000 0x1e721218000 0x1e72122e000 lib /boot/system/lib/libstdc++.so.6.0.32 8211 0x21867dee000 0x21867e4b000 0x21867e4b000 0x21867e4f000 app /boot/system/bin/nano 8209 0x7fff94d0e000 0x7fff94d16000 0x00000000 0x00000000 system commpage Areas: ID Base End Size (KiB) Protection Locking Name -------------------------------------------------------------------------------- 26478 0x30b6e13000 0x30b6e25000 72 r-x none libroot-addon-icu.so_seg0ro 26479 0x30b6e25000 0x30b6e26000 4 rw- none libroot-addon-icu.so_seg1rw 26463 0x69696b3000 0x69696bd000 40 r-x none libintl.so.8.3.0_seg0ro 26464 0x69698bc000 0x69698bd000 4 rw- none libintl.so.8.3.0_seg1rw 26465 0x69698bd000 0x69698be000 4 rw- none libintl.so.8.3.0_seg2rw 26458 0x6a05c6a000 0x6a05c7a000 64 rw- none rld heap 26473 0x93945ca000 0x93946d2000 1056 r-x none libiconv.so.2.6.1_seg0ro 26474 0x93948d1000 0x93948d4000 12 rw- none libiconv.so.2.6.1_seg1rw 26459 0x9451713000 0x9451714000 4 rw-cS none _rld_debug_ 26493 0x9aef038000 0x9aef048000 64 rw- none rld heap 26494 0x9b26961000 0x9b26971000 64 rw- none rld heap 26495 0x9b4760e000 0x9b47626000 96 rw- none rld heap 26496 0x9bde673000 0x9bde68b000 96 rw- none rld heap 26497 0x9c5daa0000 0x9c5f55b000 27372 r--S none libicuuc.so.66 mmap area 26456 0x9c89f2a000 0x9c89f47000 116 r-x none runtime_loader_seg0ro 26457 0x9c89f47000 0x9c89f48000 4 rw- none runtime_loader_seg1rw 26475 0xfa3a675000 0xfa3a694000 124 r-x none libgcc_s.so.1_seg0ro 26476 0xfa3a694000 0xfa3a695000 4 rw- none libgcc_s.so.1_seg1rw 26488 0x15baf41b000 0x15baf427000 48 r-x none libicuio.so.66.1_seg0ro 26489 0x15baf626000 0x15baf628000 8 rw- none libicuio.so.66.1_seg1rw 26483 0x15bd3d35000 0x15bd3d36000 4 r-x none libicudata.so.66.1_seg0ro 26484 0x15bd3f35000 0x15bd3f36000 4 rw- none libicudata.so.66.1_seg1rw 26470 0x15d211f5000 0x15d21305000 1088 r-x none libroot.so_seg0ro 26471 0x15d21305000 0x15d21313000 56 rw- none libroot.so_seg1rw 26472 0x15d21313000 0x15d2131b000 32 rw- none libroot.so_seg2rw 26485 0x19a5875e000 0x19a58a55000 3036 r-x none libicui18n.so.66.1_seg0ro 26486 0x19a58c54000 0x19a58c6c000 96 rw- none libicui18n.so.66.1_seg1rw 26487 0x19a58c6c000 0x19a58c6d000 4 rw- none libicui18n.so.66.1_seg2rw 26490 0x1bd20b24000 0x1bd20cf8000 1872 r-x none libicuuc.so.66.1_seg0ro 26491 0x1bd20ef8000 0x1bd20f0d000 84 rw- none libicuuc.so.66.1_seg1rw 26492 0x1bd20f0d000 0x1bd20f0e000 4 rw- none libicuuc.so.66.1_seg2rw 26466 0x1c4e9694000 0x1c4e96aa000 88 r-x none libz.so.1.3_seg0ro 26467 0x1c4e96aa000 0x1c4e96ab000 4 rw- none libz.so.1.3_seg1rw 26468 0x1e041d6a000 0x1e041dd2000 416 r-x none libncursesw.so.6.3.0_seg0ro 26469 0x1e041fd2000 0x1e041fd7000 20 rw- none libncursesw.so.6.3.0_seg1rw 26480 0x1e720fe5000 0x1e721218000 2252 r-x none libstdc++.so.6.0.32_seg0ro 26481 0x1e721218000 0x1e721226000 56 rw- none libstdc++.so.6.0.32_seg1rw 26482 0x1e721226000 0x1e72122e000 32 rw- none libstdc++.so.6.0.32_seg2rw 26460 0x21867dee000 0x21867e4b000 372 r-x none nano_seg0ro 26461 0x21867e4b000 0x21867e4e000 12 rw- none nano_seg1rw 26462 0x21867e4e000 0x21867e4f000 4 rw- none nano_seg2rw 26477 0x10f9f821a000 0x10f9f896a000 7488 rw- none heap 26454 0x7fdcb8d02000 0x7fdcb9d08000 16408 rw-s none nano_882_stack 26453 0x7ff73a026000 0x7ff73a02a000 16 rw-k full user area 26455 0x7fff94d0e000 0x7fff94d16000 32 r-xSk full commpage Protection Flags: r - read, w - write, x - execute, s - stack, o - overcommit, c - cloneable, S - shared, k - kernel Semaphores: ID Count Last Holder Name ------------------------------------------------------------
After updating to hrev57510, running same test (still basically the same results), and output of KDL instead of Debugger:
kdebug> sc 417 stack trace for thread 417 "sshd" kernel stack: 0xffffffff803a2000 to 0xffffffff803a7000 user stack: 0x00007f125bc7d000 to 0x00007f125cc7d000 frame caller <image>:function + offset 0 ffffffff803a6c00 (+ 112) ffffffff8009f21e <kernel_x86_64> reschedule(int) + 0x43e 1 ffffffff803a6c70 (+ 48) ffffffff80089fd6 <kernel_x86_64> thread_block + 0xc6 2 ffffffff803a6ca0 (+ 96) ffffffff8009a301 <kernel_x86_64> _mutex_lock + 0xd1 3 ffffffff803a6d00 (+ 32) ffffffff8009a4ce <kernel_x86_64> recursive_lock_lock + 0x3e 4 ffffffff803a6d20 (+ 80) ffffffff8210b24a </boot/system/add-ons/kernel/generic/tty> tty_deselect(tty_cookie*, unsigned char, selectsync*) + 0x3a 5 ffffffff803a6d70 (+ 64) ffffffff800ee7ed <kernel_x86_64> deselect_fd + 0xfd 6 ffffffff803a6db0 (+ 128) ffffffff800940f0 <kernel_x86_64> common_poll(pollfd*, unsigned long, long, unsigned long const*, bool) + 0x1e0 7 ffffffff803a6e30 (+ 240) ffffffff80095155 <kernel_x86_64> _user_poll + 0x165 8 ffffffff803a6f20 (+ 16) ffffffff8014d02f <kernel_x86_64> x86_64_syscall_entry + 0xfb user iframe at 0xffffffff803a6f30 (end = 0xffffffff803a6ff8) rax 0x84 rbx 0x7f125cc7ba64 rcx 0x1db33d03a5c rdx 0xffffffffffffffff rsi 0x4 rdi 0x103b72117d20 rbp 0x7f125cc7b770 r8 0x0 r9 0x0 r10 0x7f125cc7ba80 r11 0x246 r12 0x7f125cc7b7b0 r13 0x0 r14 0x7f125cc7ba70 r15 0x103b72109740 rip 0x1db33d03a5c rsp 0x7f125cc7b758 rflags 0x246 vector: 0x63, error code: 0x0 9 ffffffff803a6f30 (+139718986385472) 000001db33d03a5c <libroot.so> _kern_poll + 0x0c 10 00007f125cc7b770 (+ 656) 000000697eaeaffb <sshd> dump_config (nearest) + 0x2c9b 11 00007f125cc7ba00 (+ 192) 000000697eaec46e <sshd> server_loop2 + 0x2de 12 00007f125cc7bac0 (+ 96) 000000697eaf8988 <sshd> do_authenticated + 0x1b8 13 00007f125cc7bb20 (+1712) 000000697eada995 <sshd> main + 0x3735 14 00007f125cc7c1d0 (+ 48) 000000697eadb8df <sshd> _start + 0x3f 15 00007f125cc7c200 (+ 48) 00000008321b8ab5 </boot/system/runtime_loader@0x00000008321a9000> <unknown> + 0xfab5 16 00007f125cc7c230 (+ 0) 00007fff7ab84258 <commpage> commpage_thread_exit + 0x00 kdebug> sc 492 stack trace for thread 492 "nano" kernel stack: 0xffffffff803ac000 to 0xffffffff803b1000 user stack: 0x00007f22e2246000 to 0x00007f22e3246000 frame caller <image>:function + offset 0 ffffffff803b0c00 (+ 112) ffffffff8009f21e <kernel_x86_64> reschedule(int) + 0x43e 1 ffffffff803b0c70 (+ 48) ffffffff80089fd6 <kernel_x86_64> thread_block + 0xc6 2 ffffffff803b0ca0 (+ 96) ffffffff8009a301 <kernel_x86_64> _mutex_lock + 0xd1 3 ffffffff803b0d00 (+ 32) ffffffff8009a4ce <kernel_x86_64> recursive_lock_lock + 0x3e 4 ffffffff803b0d20 (+ 80) ffffffff8210b24a </boot/system/add-ons/kernel/generic/tty> tty_deselect(tty_cookie*, unsigned char, selectsync*) + 0x3a 5 ffffffff803b0d70 (+ 64) ffffffff800ee7ed <kernel_x86_64> deselect_fd + 0xfd 6 ffffffff803b0db0 (+ 128) ffffffff800940f0 <kernel_x86_64> common_poll(pollfd*, unsigned long, long, unsigned long const*, bool) + 0x1e0 7 ffffffff803b0e30 (+ 240) ffffffff80095198 <kernel_x86_64> _user_poll + 0x1a8 8 ffffffff803b0f20 (+ 16) ffffffff8014d02f <kernel_x86_64> x86_64_syscall_entry + 0xfb user iframe at 0xffffffff803b0f30 (end = 0xffffffff803b0ff8) rax 0x84 rbx 0x7f22e32452a0 rcx 0xb27147ba5c rdx 0x0 rsi 0x1 rdi 0x7f22e32452a0 rbp 0x7f22e3245250 r8 0x116182202690 r9 0x1161822248f0 r10 0x0 r11 0x202 r12 0x7f22e32452b0 r13 0x0 r14 0x0 r15 0x88f23 rip 0xb27147ba5c rsp 0x7f22e3245238 rflags 0x202 vector: 0x63, error code: 0x0 9 ffffffff803b0f30 (+139789960037152) 000000b27147ba5c <libroot.so> _kern_poll + 0x0c 10 00007f22e3245250 (+ 160) 00000007c42ce5e1 <libncursesw.so.6> _nc_timed_wait + 0x121 11 00007f22e32452f0 (+ 240) 00000007c42aa515 <libncursesw.so.6> _nc_wgetch + 0x875 12 00007f22e32453e0 (+ 48) 00000007c42aa9cb <libncursesw.so.6> wgetch + 0x2b 13 00007f22e3245410 (+ 80) 000001ba588e6e48 <nano> read_keys_from + 0xf8 14 00007f22e3245460 (+ 16) 000001ba588e71f2 <nano> get_input + 0x52 15 00007f22e3245470 (+ 48) 000001ba588e724a <nano> parse_kbinput + 0x2a 16 00007f22e32454a0 (+ 48) 000001ba588e7a00 <nano> get_kbinput + 0x20 17 00007f22e32454d0 (+ 80) 000001ba588d37d5 <nano> suck_up_input_and_paste_it + 0x85 18 00007f22e3245520 (+ 64) 000001ba588d3fad <nano> process_a_keystroke + 0x3cd 19 00007f22e3245560 (+1984) 000001ba588c08ab <nano> main + 0xe7b 20 00007f22e3245d20 (+ 48) 000001ba588c118f <nano> _start + 0x3f 21 00007f22e3245d50 (+ 48) 0000006e43d47ab5 </boot/system/runtime_loader@0x0000006e43d38000> <unknown> + 0xfab5 22 00007f22e3245d80 (+ 0) 00007ffffec45258 <commpage> commpage_thread_exit + 0x00
comment:6 by , 11 months ago
So, this isn't a live lock: there are characters actually being received by nano (strace shows this, and rebuilding nano in debug mode demonstrates it.) But the characters (at least in my case) appear to be lots and lots of "7"s. Killing nano gets things going for a bit as noted, with tons of 7s indeed appearing before everything stalls yet again.
Resizing the window on the remote end gets things going again, but with lots of the bogus/garbage characters. Actually, it looks like the datastream is repeating over and over again.
After killing
nano
, input starts getting fed intobash
, but it gets into intermittent delays receiving backlog of input; however, it does actually slowly make progress. Perhapsbash
is providing a timeout to allow poll/select to fail, unlikenano
?