Subject: 27.1; zzzzzzzz forever

From: Bruce Adams <[email-masked]>
Date: Thu, 7 Sep 2023 20:33:31 +0000

I have observed two issues while running emacs under WSL2 (Ubuntu 22.04)
on Windows 11.
I know this is a heresy but it should still work and does mostly.

This bug report concerns issue one which is that sometimes
my emacs inexplicably starts filling with repeated zzzzzzz characters.
Though other editing activity is possible inbetween 'attacks'

This continues even if I unplug the keyboard (to rule out a USB keyboard
issue).zzzzzzzzzzzzzzzzzzzzzzz
It is possible to get control back temporarily by changing the window
size.zzzzzzzzzzzzzz
The added zzzzz... can be undone using ctrl-u.

This only happens to me with emacs under WSL.
Not with emacs running under cygin
or in a genuine linux host.
Though I have a suspicion it might relates to pressing ctrl-z somehow.

I have also observed a possibly related hang.

My second issue is that if left running (typically unattended or out of
focus) for a long time emacs crashes. I will try to add a second bug report
with a backtrace when this happens.
I did not have the debug symbols installed for previous occurances but
it is quite repeatable.

I had hoped the most recent update would fix this but it doesn't.

    emacs (1:27.1+1-3ubuntu5.1) jammy; urgency=medium

      * debian/patches/0001-Use-a-64KB-page-size-for-pdump.patch: cherry-pick
        a change from upstream that fixes a crash when booted on a 64K page
        kernel on arm64. LP: #2030892.

I have a couple of backtraces below for the zzzz issue:

Reading symbols from emacs...
Reading symbols from /usr/lib/debug/.build-id/96/8bd488365ca5ef23edbd3ff2265fa59c1ed52e.debug...
Attaching to program: /usr/bin/emacs, process 31835
[New LWP 31836]
[New LWP 31837]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
pselect64_syscall (sigmask=<optimized out>, timeout=<optimized out>, exceptfds=0x0, writefds=0x7ffdcff6aad0, readfds=0x7ffdcff6aa50, nfds=7) at ../sysdeps/unix/sysv/linux/pselect.c:34
34      ../sysdeps/unix/sysv/linux/pselect.c: No such file or directory.
(gdb) where
#0  pselect64_syscall (sigmask=<optimized out>, timeout=<optimized out>, exceptfds=0x0, writefds=0x7ffdcff6aad0, readfds=0x7ffdcff6aa50, nfds=7) at ../sysdeps/unix/sysv/linux/pselect.c:34
#1  __pselect (nfds=7, readfds=0x7ffdcff6aa50, writefds=0x7ffdcff6aad0, exceptfds=0x0, timeout=<optimized out>, sigmask=<optimized out>) at ../sysdeps/unix/sysv/linux/pselect.c:56
#2  0x000056552f834785 in really_call_select (arg=0x7ffdcff6a960) at ./debian/build-src/src/thread.c:586
#3  0x000056552f83551d in thread_select (func=<optimized out>, max_fds=max_fds@entry=7, rfds=rfds@entry=0x7ffdcff6aa50, wfds=wfds@entry=0x7ffdcff6aad0, efds=efds@entry=0x0,
    timeout=timeout@entry=0x7ffdcff6b070, sigmask=0x0) at ./debian/build-src/src/thread.c:616
#4  0x000056552f85238f in xg_select (fds_lim=7, rfds=rfds@entry=0x7ffdcff6b180, wfds=wfds@entry=0x7ffdcff6b200, efds=efds@entry=0x0, timeout=timeout@entry=0x7ffdcff6b070,
    sigmask=sigmask@entry=0x0) at ./debian/build-src/src/xgselect.c:117
#5  0x000056552f812319 in wait_reading_process_output (time_limit=time_limit@entry=30, nsecs=nsecs@entry=0, read_kbd=read_kbd@entry=-1, do_display=do_display@entry=true,
    wait_for_cell=wait_for_cell@entry=0x0, wait_proc=wait_proc@entry=0x0, just_wait_proc=0) at ./debian/build-src/src/process.c:5571
#6  0x000056552f676d53 in sit_for (timeout=timeout@entry=0x7a, reading=reading@entry=true, display_option=display_option@entry=1) at ./debian/build-src/src/dispnew.c:6056
#7  0x000056552f75d494 in read_char (commandflag=1, map=0x5655312ca9d3, prev_event=0x0, used_mouse_menu=0x7ffdcff6ba4b, end_time=0x0) at ./debian/build-src/src/keyboard.c:2738
#8  0x000056552f75db6a in read_key_sequence (keybuf=<optimized out>, prompt=0x0, dont_downcase_last=<optimized out>, can_return_switch_frame=true, fix_current_buffer=true,
    prevent_redisplay=<optimized out>) at ./debian/build-src/src/keyboard.c:9553
#9  0x000056552f75f30c in command_loop_1 () at ./debian/build-src/src/keyboard.c:1350
#10 0x000056552f7ccf67 in internal_condition_case (bfun=bfun@entry=0x56552f75f110 <command_loop_1>, handlers=handlers@entry=0x90, hfun=hfun@entry=0x56552f755a80 <cmd_error>)
    at ./debian/build-src/src/eval.c:1356
#11 0x000056552f7500f0 in command_loop_2 (ignore=ignore@entry=0x0) at ./debian/build-src/src/keyboard.c:1091
#12 0x000056552f7ccea9 in internal_catch (tag=tag@entry=0xd530, func=func@entry=0x56552f7500c0 <command_loop_2>, arg=arg@entry=0x0) at ./debian/build-src/src/eval.c:1117
#13 0x000056552f75007e in command_loop () at ./debian/build-src/src/keyboard.c:1070
#14 0x000056552f75568a in recursive_edit_1 () at ./debian/build-src/src/keyboard.c:714
#15 0x000056552f7559c9 in Frecursive_edit () at ./debian/build-src/src/keyboard.c:786
#16 0x000056552f66caca in main (argc=2, argv=<optimized out>) at ./debian/build-src/src/emacs.c:2062

---

Reading symbols from emacs...
Reading symbols from /usr/lib/debug/.build-id/96/8bd488365ca5ef23edbd3ff2265fa59c1ed52e.debug...
Attaching to program: /usr/bin/emacs, process 31835
[New LWP 31836]
[New LWP 31837]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
pselect64_syscall (sigmask=<optimized out>, timeout=<optimized out>, exceptfds=0x0, writefds=0x7ffdcff6aad0, readfds=0x7ffdcff6aa50, nfds=7) at ../sysdeps/unix/sysv/linux/pselect.c:34
34      ../sysdeps/unix/sysv/linux/pselect.c: No such file or directory.
(gdb) where
#0  pselect64_syscall (sigmask=<optimized out>, timeout=<optimized out>, exceptfds=0x0, writefds=0x7ffdcff6aad0, readfds=0x7ffdcff6aa50, nfds=7) at ../sysdeps/unix/sysv/linux/pselect.c:34
#1  __pselect (nfds=7, readfds=0x7ffdcff6aa50, writefds=0x7ffdcff6aad0, exceptfds=0x0, timeout=<optimized out>, sigmask=<optimized out>) at ../sysdeps/unix/sysv/linux/pselect.c:56
#2  0x000056552f834785 in really_call_select (arg=0x7ffdcff6a960) at ./debian/build-src/src/thread.c:586
#3  0x000056552f83551d in thread_select (func=<optimized out>, max_fds=max_fds@entry=7, rfds=rfds@entry=0x7ffdcff6aa50, wfds=wfds@entry=0x7ffdcff6aad0, efds=efds@entry=0x0,
    timeout=timeout@entry=0x7ffdcff6b070, sigmask=0x0) at ./debian/build-src/src/thread.c:616
#4  0x000056552f85238f in xg_select (fds_lim=7, rfds=rfds@entry=0x7ffdcff6b180, wfds=wfds@entry=0x7ffdcff6b200, efds=efds@entry=0x0, timeout=timeout@entry=0x7ffdcff6b070,
    sigmask=sigmask@entry=0x0) at ./debian/build-src/src/xgselect.c:117
#5  0x000056552f812319 in wait_reading_process_output (time_limit=time_limit@entry=30, nsecs=nsecs@entry=0, read_kbd=read_kbd@entry=-1, do_display=do_display@entry=true,
    wait_for_cell=wait_for_cell@entry=0x0, wait_proc=wait_proc@entry=0x0, just_wait_proc=0) at ./debian/build-src/src/process.c:5571
#6  0x000056552f676d53 in sit_for (timeout=timeout@entry=0x7a, reading=reading@entry=true, display_option=display_option@entry=1) at ./debian/build-src/src/dispnew.c:6056
#7  0x000056552f75d494 in read_char (commandflag=1, map=0x5655312ca9d3, prev_event=0x0, used_mouse_menu=0x7ffdcff6ba4b, end_time=0x0) at ./debian/build-src/src/keyboard.c:2738
#8  0x000056552f75db6a in read_key_sequence (keybuf=<optimized out>, prompt=0x0, dont_downcase_last=<optimized out>, can_return_switch_frame=true, fix_current_buffer=true,
    prevent_redisplay=<optimized out>) at ./debian/build-src/src/keyboard.c:9553
#9  0x000056552f75f30c in command_loop_1 () at ./debian/build-src/src/keyboard.c:1350
#10 0x000056552f7ccf67 in internal_condition_case (bfun=bfun@entry=0x56552f75f110 <command_loop_1>, handlers=handlers@entry=0x90, hfun=hfun@entry=0x56552f755a80 <cmd_error>)
    at ./debian/build-src/src/eval.c:1356
#11 0x000056552f7500f0 in command_loop_2 (ignore=ignore@entry=0x0) at ./debian/build-src/src/keyboard.c:1091
#12 0x000056552f7ccea9 in internal_catch (tag=tag@entry=0xd530, func=func@entry=0x56552f7500c0 <command_loop_2>, arg=arg@entry=0x0) at ./debian/build-src/src/eval.c:1117
#13 0x000056552f75007e in command_loop () at ./debian/build-src/src/keyboard.c:1070
#14 0x000056552f75568a in recursive_edit_1 () at ./debian/build-src/src/keyboard.c:714
#15 0x000056552f7559c9 in Frecursive_edit () at ./debian/build-src/src/keyboard.c:786
#16 0x000056552f66caca in main (argc=2, argv=<optimized out>) at ./debian/build-src/src/emacs.c:2062