Closed tristan957 closed 2 months ago
Was able to get this after using ReleaseSafe instead of ReleaseFast
thread 34840 panic: division by zero
/home/tristan957/.cache/zig/p/12203f02184c2561b288ea99b7c438d05c6448f04636bce970d391ab581c72edf5c0/src/main.zig:64:30: 0x10423ea in panic_handler (comlink)
std.builtin.default_panic(msg, error_return_trace, ret_addr);
^
/home/tristan957/.cache/zig/p/12203f02184c2561b288ea99b7c438d05c6448f04636bce970d391ab581c72edf5c0/src/posix/Tty.zig:0:20: 0x108d205 in ttyRun (comlink)
/usr/lib/zig/std/Thread.zig:429:13: 0x10730af in entryFn (comlink)
@call(.auto, f, args) catch |err| {
^
???:?:?: 0x7f7b93013506 in ??? (libc.so.6)
Unwind information for `libc.so.6:0x7f7b93013506` was not available, trace may be incomplete
???:?:?: 0x7f7b9309740b in ??? (libc.so.6)
fish: Job 1, 'comlink -h' terminated by signal SIGABRT (Abort)
Even better log from Debug
$ gdb comlink
Reading symbols from comlink...
(gdb) r
Starting program: /home/tristan957/.local/bin/comlink
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7ffff7c006c0 (LWP 36530)]
thread 36530 panic: division by zero
/home/tristan957/.cache/zig/p/12203f02184c2561b288ea99b7c438d05c6448f04636bce970d391ab581c72edf5c0/src/main.zig:64:30: 0x10dc6ba in panic_handler (comlink)
std.builtin.default_panic(msg, error_return_trace, ret_addr);
^
/home/tristan957/.cache/zig/p/12203f02184c2561b288ea99b7c438d05c6448f04636bce970d391ab581c72edf5c0/src/Vaxis.zig:707:46: 0x11e7d66 in translateMouse (comlink)
const xextra = self.screen.width_pix % self.screen.width;
^
/home/tristan957/.cache/zig/p/12203f02184c2561b288ea99b7c438d05c6448f04636bce970d391ab581c72edf5c0/src/Loop.zig:228:76: 0x11e74aa in handleEventGeneric__anon_15724 (comlink)
return self.postEvent(.{ .mouse = vx.translateMouse(mouse) });
^
/home/tristan957/.cache/zig/p/12203f02184c2561b288ea99b7c438d05c6448f04636bce970d391ab581c72edf5c0/src/Loop.zig:158:51: 0x11e87aa in ttyRun (comlink)
try handleEventGeneric(self, self.vaxis, &cache, Event, event, paste_allocator);
^
/usr/lib/zig/std/Thread.zig:429:13: 0x119ebc2 in callFn__anon_14644 (comlink)
@call(.auto, f, args) catch |err| {
^
/usr/lib/zig/std/Thread.zig:674:30: 0x1140d52 in entryFn (comlink)
return callFn(f, args_ptr.*);
^
???:?:?: 0x7ffff7d67506 in ??? (libc.so.6)
Unwind information for `libc.so.6:0x7ffff7d67506` was not available, trace may be incomplete
???:?:?: 0x7ffff7deb40b in ??? (libc.so.6)
Thread 2 "comlink" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff7c006c0 (LWP 36530)]
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
Downloading source file /usr/src/debug/glibc-2.39-17.fc40.x86_64/nptl/pthread_kill.c
44 return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
(gdb) bt
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1 0x00007ffff7d69513 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#2 0x00007ffff7d10c4e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3 0x00007ffff7cf8902 in __GI_abort () at abort.c:79
#4 0x00000000011c86d9 in posix.abort () at /usr/lib/zig/std/posix.zig:689
#5 0x0000000001190cc4 in debug.panicImpl (trace=0x0, first_trace_addr=..., msg=...) at /usr/lib/zig/std/debug.zig:510
#6 0x00000000011363e7 in builtin.default_panic (msg=..., error_return_trace=0x0, ret_addr=...) at /usr/lib/zig/std/builtin.zig:857
#7 0x00000000010dc6bb in main.panic_handler (msg=..., error_return_trace=0x0, ret_addr=...) at /home/tristan957/.cache/zig/p/12203f02184c2561b288ea99b7c438d05c6448f04636bce970d391ab581c72edf5c0/src/main.zig:64
#8 0x00000000011e7d67 in Vaxis.translateMouse (self=..., mouse=...) at /home/tristan957/.cache/zig/p/12203f02184c2561b288ea99b7c438d05c6448f04636bce970d391ab581c72edf5c0/src/Vaxis.zig:707
#9 0x00000000011e74ab in Loop.handleEventGeneric__anon_15724 (self=0x7ffffffdb480, vx=0x7ffffffdb2d0, cache=0x7ffff7bfd690, event=..., paste_allocator=...) at /home/tristan957/.cache/zig/p/12203f02184c2561b288ea99b7c438d05c6448f04636bce970d391ab581c72edf5c0/src/Loop.zig:228
#10 0x00000000011e87ab in Loop.Loop(App.Event).ttyRun (self=0x7ffffffdb480, grapheme_data=0x7ffffffdb378, paste_allocator=...) at /home/tristan957/.cache/zig/p/12203f02184c2561b288ea99b7c438d05c6448f04636bce970d391ab581c72edf5c0/src/Loop.zig:158
#11 0x000000000119ebc3 in Thread.callFn__anon_14644 (args=...) at /usr/lib/zig/std/Thread.zig:429
#12 0x0000000001140d53 in Thread.PosixThreadImpl.spawn__anon_11045.Instance.entryFn (raw_arg=0x15e82a0) at /usr/lib/zig/std/Thread.zig:674
#13 0x00007ffff7d67507 in start_thread (arg=<optimized out>) at pthread_create.c:447
#14 0x00007ffff7deb40c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
gdb) frame 8
#8 0x00000000011e7d67 in Vaxis.translateMouse (self=..., mouse=...) at /home/tristan957/.cache/zig/p/12203f02184c2561b288ea99b7c438d05c6448f04636bce970d391ab581c72edf5c0/src/Vaxis.zig:707
707 const xextra = self.screen.width_pix % self.screen.width;
(gdb) p self.screen.width
$1 = 0
(gdb) p self.screen.width_pix
$2 = 0
Terminal is latest ghostty by the way.
I was able to track this down to this portion of your config somehow getting a mouse event to the screen when it had a zero size
local proc = assert(io.popen("op --account my.1password.com read op://Personal/chat.sr.ht/credential", "r"))
local pass = proc:read("*l")
proc:close()
I patched libvaxis to check for zero sizes before continuuing in the translateMouse
function. I am not sure how this all happens but I know that is what is happening.
Fixed in e2a24d674e9d
I wonder if this is reproducible with popen(3) from C, or the equivalent Zig function call.
Here is my config:
Comlink then crashes with a SIGFPE and results in a terminal which becomes unusable. Control codes get printed to the screen.