Subject: Re: bug#70914: 29.3; Crashes often on Windows

From: Simen Endsjø <[email-masked]>
Date: Wed, 15 May 2024 12:53:23 +0200

> In any case, please keep running Emacs under GDB and post two or three
> more backtraces from the crash, so that we could see which parts of
> this to focus on.

Another crash in what seems to be another location:

    Attaching to process 9804
    [New Thread 9804.0xc30]
    [New Thread 9804.0x2e50]
    [New Thread 9804.0x19a0]
    [New Thread 9804.0x506c]
    [New Thread 9804.0x35a4]
    [New Thread 9804.0x4be4]
    [New Thread 9804.0x246c]
    Reading symbols from C:\programs\emacs\latest\bin\emacs.exe...
    (gdb) continue
    Continuing.
    [Thread 9804.0x246c exited with code 0]

    Thread 1 received signal SIGTRAP, Trace/breakpoint trap.
    [Switching to Thread 9804.0x2ab4]
    0x00007fffd85dd313 in KERNELBASE!DebugBreak () from
C:\WINDOWS\System32\KernelBase.dll
    (gdb) thread apply all bt

    Thread 7 (Thread 9804.0x4be4):
    #0  0x00007fffdabf35a4 in ntdll!ZwWaitForWorkViaWorkerFactory ()
from C:\WINDOWS\SYSTEM32\ntdll.dll
    #1  0x00007fffdab8537e in ntdll!RtlClearThreadWorkOnBehalfTicket
() from C:\WINDOWS\SYSTEM32\ntdll.dll
    #2  0x00007fffd993257d in KERNEL32!BaseThreadInitThunk () from
C:\WINDOWS\System32\kernel32.dll
    #3  0x00007fffdabaaa48 in ntdll!RtlUserThreadStart () from
C:\WINDOWS\SYSTEM32\ntdll.dll
    #4  0x0000000000000000 in ?? ()

    Thread 6 (Thread 9804.0x35a4):
    #0  0x00007fffdabf35a4 in ntdll!ZwWaitForWorkViaWorkerFactory ()
from C:\WINDOWS\SYSTEM32\ntdll.dll
    #1  0x00007fffdab8537e in ntdll!RtlClearThreadWorkOnBehalfTicket
() from C:\WINDOWS\SYSTEM32\ntdll.dll
    #2  0x00007fffd993257d in KERNEL32!BaseThreadInitThunk () from
C:\WINDOWS\System32\kernel32.dll
    #3  0x00007fffdabaaa48 in ntdll!RtlUserThreadStart () from
C:\WINDOWS\SYSTEM32\ntdll.dll
    #4  0x0000000000000000 in ?? ()

    Thread 5 (Thread 9804.0x506c):
    #0  0x00007fffdabf35a4 in ntdll!ZwWaitForWorkViaWorkerFactory ()
from C:\WINDOWS\SYSTEM32\ntdll.dll
    #1  0x00007fffdab8537e in ntdll!RtlClearThreadWorkOnBehalfTicket
() from C:\WINDOWS\SYSTEM32\ntdll.dll
    #2  0x00007fffd993257d in KERNEL32!BaseThreadInitThunk () from
C:\WINDOWS\System32\kernel32.dll
    #3  0x00007fffdabaaa48 in ntdll!RtlUserThreadStart () from
C:\WINDOWS\SYSTEM32\ntdll.dll
    #4  0x0000000000000000 in ?? ()

    Thread 4 (Thread 9804.0x19a0):
    #0  0x00007fffdabef9d4 in ntdll!ZwWaitForSingleObject () from
C:\WINDOWS\SYSTEM32\ntdll.dll
    #1  0x00007fffd850427e in WaitForSingleObjectEx () from
C:\WINDOWS\System32\KernelBase.dll
    #2  0x00007ff71859e488 in reader_thread ()
    #3  0x00007fffd993257d in KERNEL32!BaseThreadInitThunk () from
C:\WINDOWS\System32\kernel32.dll
    #4  0x00007fffdabaaa48 in ntdll!RtlUserThreadStart () from
C:\WINDOWS\SYSTEM32\ntdll.dll
    #5  0x0000000000000000 in ?? ()

    Thread 3 (Thread 9804.0x2e50 "pool"):
    #0  0x00007fffdabf3544 in ntdll!ZwWaitForAlertByThreadId () from
C:\WINDOWS\SYSTEM32\ntdll.dll
    #1  0x00007fffdabb91db in ntdll!RtlSleepConditionVariableSRW ()
from C:\WINDOWS\SYSTEM32\ntdll.dll
    #2  0x00007fffd8542b79 in SleepConditionVariableSRW () from
C:\WINDOWS\System32\KernelBase.dll
    #3  0x00007fff6be8637b in ?? () from
C:\programs\emacs\latest\bin\libglib-2.0-0.dll
    #4  0x00007fff6bee9a5b in ?? () from
C:\programs\emacs\latest\bin\libglib-2.0-0.dll
    #5  0x00007fff6bee90a1 in ?? () from
C:\programs\emacs\latest\bin\libglib-2.0-0.dll
    #6  0x00007fff6bf18897 in ?? () from
C:\programs\emacs\latest\bin\libglib-2.0-0.dll
    --Type <RET> for more, q to quit, c to continue without paging--c
    #7  0x00007fffd9f3e634 in msvcrt!_beginthreadex () from
C:\WINDOWS\System32\msvcrt.dll
    #8  0x00007fffd9f3e70c in msvcrt!_endthreadex () from
C:\WINDOWS\System32\msvcrt.dll
    #9  0x00007fffd993257d in KERNEL32!BaseThreadInitThunk () from
C:\WINDOWS\System32\kernel32.dll
    #10 0x00007fffdabaaa48 in ntdll!RtlUserThreadStart () from
C:\WINDOWS\SYSTEM32\ntdll.dll
    #11 0x0000000000000000 in ?? ()

    Thread 2 (Thread 9804.0xc30):
    #0  0x00007fffd82e1534 in win32u!NtUserGetMessage () from
C:\WINDOWS\System32\win32u.dll
    #1  0x00007fffd9a75eca in USER32!GetMessageW () from
C:\WINDOWS\System32\user32.dll
    #2  0x00007ff718565e79 in w32_msg_pump ()
    #3  0x00007ff7185665ab in w32_msg_worker ()
    #4  0x00007fffd993257d in KERNEL32!BaseThreadInitThunk () from
C:\WINDOWS\System32\kernel32.dll
    #5  0x00007fffdabaaa48 in ntdll!RtlUserThreadStart () from
C:\WINDOWS\SYSTEM32\ntdll.dll
    #6  0x0000000000000000 in ?? ()

    Thread 1 (Thread 9804.0x2ab4):
    #0  0x00007fffd85dd313 in KERNELBASE!DebugBreak () from
C:\WINDOWS\System32\KernelBase.dll
    #1  0x00007ff718565ba8 in emacs_abort ()
    #2  0x00007ff718436aae in terminate_due_to_signal ()
    #3  0x00007ff718457a9c in deliver_fatal_thread_signal ()
    #4  0x00007ff7185cb122 in _gnu_exception_handler
(exception_data=0xabbdffb9c0) at
C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt_handler.c:223
    #5  0x00007fffd9f2b248 in msvcrt!__C_specific_handler () from
C:\WINDOWS\System32\msvcrt.dll
    #6  0x00007fffdabf49ff in ntdll!.chkstk () from
C:\WINDOWS\SYSTEM32\ntdll.dll
    #7  0x00007fffdab6e466 in ntdll!RtlFindCharInUnicodeString () from
C:\WINDOWS\SYSTEM32\ntdll.dll
    #8  0x00007fffdabf39ee in ntdll!KiUserExceptionDispatcher () from
C:\WINDOWS\SYSTEM32\ntdll.dll
    #9  0x00007ff718494bb3 in rpl_re_compile_pattern ()
    #10 0x00007ff718486f19 in compile_pattern ()
    #11 0x00007ff7184871dd in looking_at_1 ()
    #12 0x00007ff7184c5688 in Ffuncall ()
    #13 0x00007fff6185155a in
F73702d736b69702d666f72776172642d746f2d73796d626f6c_sp_skip_forward_to_symbol_0
() from d:\.emacs.d\.local\cache\eln\29.3-5efa4952\smartparens-7ac9a6ec-f08b49fa.eln
    #14 0x00007ff7184c5688 in Ffuncall ()
    #15 0x00007fff618426ff in F73702d6765742d7468696e67_sp_get_thing_0
() from d:\.emacs.d\.local\cache\eln\29.3-5efa4952\smartparens-7ac9a6ec-f08b49fa.eln
    #16 0x00007ff7184c982c in eval_sub ()
    #17 0x00007ff7184c9a1d in Fprogn ()
    #18 0x00007ff7184c969d in eval_sub ()
    #19 0x00007ff7184cbdec in internal_lisp_condition_case ()
    #20 0x00007ff7184c969d in eval_sub ()
    #21 0x00007ff7184c969d in eval_sub ()
    #22 0x00007ff7184cb6e6 in FletX ()
    #23 0x00007ff7184c969d in eval_sub ()
    #24 0x00007ff7184ca965 in funcall_lambda ()
    #25 0x00007ff7184caefd in apply_lambda ()
    #26 0x00007ff7184c9070 in eval_sub ()
    #27 0x00007ff7184ca368 in Fcond ()
    #28 0x00007ff7184c969d in eval_sub ()
    #29 0x00007ff7184cb885 in FletX ()
    #30 0x00007ff7184c969d in eval_sub ()
    #31 0x00007ff7184ca368 in Fcond ()
    #32 0x00007ff7184c969d in eval_sub ()
    #33 0x00007ff7184ca38d in Fcond ()
    #34 0x00007ff7184c969d in eval_sub ()
    #35 0x00007ff7184ca965 in funcall_lambda ()
    #36 0x00007ff7184c5688 in Ffuncall ()
    #37 0x00007ff7184c58b8 in Fapply ()
    #38 0x00007ff71850eac2 in exec_byte_code ()
    #39 0x00007ff7184ca715 in funcall_lambda ()
    #40 0x00007ff7184c5688 in Ffuncall ()
    #41 0x00007ff7184c58b8 in Fapply ()
    #42 0x00007ff71850eac2 in exec_byte_code ()
    #43 0x00007ff7184c5688 in Ffuncall ()
    #44 0x00007ff7184c12f7 in Ffuncall_interactively ()
    #45 0x00007ff7184c5688 in Ffuncall ()
    #46 0x00007ff7184c2687 in Fcall_interactively ()
    #47 0x00007ff7184c5688 in Ffuncall ()
    #48 0x00007ff7184c12f7 in Ffuncall_interactively ()
    #49 0x00007ff7184c5688 in Ffuncall ()
    #50 0x00007ff7184c5b2a in Fapply ()
    #51 0x00007ff7184c2ae0 in Fcall_interactively ()
    #52 0x00007fff835befdf in
F636f6d6d616e642d65786563757465_command_execute_0 () from
c:\programs\emacs\latest\lib\emacs\29.3\native-lisp\29.3-5efa4952\preloaded\simple-fab5b0cf-9ff4140c.eln
    #53 0x00007ff7184c5688 in Ffuncall ()
    #54 0x00007ff71844bdd2 in command_loop_1 ()
    #55 0x00007ff7184c3c7d in internal_condition_case ()
    #56 0x00007ff7184373ae in command_loop_2 ()
    #57 0x00007ff7184c3beb in internal_catch ()
    #58 0x00007ff71843733c in command_loop ()
    #59 0x00007ff71843f98d in recursive_edit_1 ()
    #60 0x00007ff71843fd50 in Frecursive_edit ()
    #61 0x00007ff7185dd170 in main ()

On Tue, May 14, 2024 at 1:23 PM Eli Zaretskii <[email-masked]> wrote:
>
> > From: Simen Endsjø <[email-masked]>
> > Date: Tue, 14 May 2024 12:14:11 +0200
> > Cc: [email-masked]
> >
> > Here's a backtrace of the most recent crash. I have no idea if it's
> > one issue or several. It seems to be crashing at arbitrary times,
> > often just when writing plain text in org-mode buffers.
>
> It's unclear what happened here and why.  Seems like some fatal
> exception in the middle of all-completions call, but why would that
> be?
>
> I do see that you have quite a few 3rd-party packages involved in
> this: vertico, orderless, and consult at least.
>
> I also see that one of the threads is run by Glib, which sounds
> strange to me, but maybe it's because of librsvg?  Not sure if this is
> related to the crash.
>
> This part of your environment:
>
>   Important settings:
>     value of $LANG: en_US
>     locale-coding-system: cp65001   <<<<<<<<<<<<<<<<<<<<<<<
>
> might also be related: AFAIU it means you configured your system to
> use UTF-8 encoding by default, which might cause issues with
> sub-processes, because Emacs on Windows doesn't support passing UTF-8
> encoded arguments to sub-processes.  And the backtrace indicates that
> you had a sub-process running when this happened (or at least a thread
> was running waiting for output from a sub-process).
>
> And why is the value of $LANG "en_US"?  It's supposed to be "ENU" on
> Windows.  Did you customize the locale and/or the defaults for the
> coding-systems, and if so, how?
>
> In any case, please keep running Emacs under GDB and post two or three
> more backtraces from the crash, so that we could see which parts of
> this to focus on.
>
> Thanks.