bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67900: 30.0.50; Emacs Crahes When Executing Command `consult-buffer'


From: Eli Zaretskii
Subject: bug#67900: 30.0.50; Emacs Crahes When Executing Command `consult-buffer'
Date: Wed, 20 Dec 2023 15:10:21 +0200

[Please use Reply All to reply, to keep the bug tracker CC'ed.]

> From: Chang Xiaoduan <drcxd@sina.com>
> Date: Wed, 20 Dec 2023 14:37:30 +0800
> 
> Hello Eli,
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > We need a reproducible recipe, starting from "emacs -Q", to reproduce
> > the problem, so we could debug it here and find the reason(s).  Can
> > you please provide such a recipe?  It is okay to include in the recipe
> > commands that load add-on packages, as long as you clearly tell where
> > to get those packages and how to load them.
> >
> > Thanks.
> 
> I have tried my best but what I found at best is an unreliable
> reproducible recipe.
> 
> Start Emacs with `emacs -Q` then evaluate the following expressions one
> by one:
> 
> ```
> (require 'package)
> (setq package-archives
>       '(
>         ("gnu" . "https://elpa.gnu.org/packages/";)
>         ("melpa" . "https://melpa.org/packages/";)
>         ("nongnu" . "https://elpa.nongnu.org/nongnu/";)))
> (unless (package-installed-p 'use-package)
>   (package-install 'use-package))
> (require 'use-package)
> (setq use-package-always-ensure t)
> 
> (use-package consult)
> ```
> 
> After you have evaluated `(use-package consult)`, you may experience a
> crash when Emacs is compiling its code. The backtrace for this crash:
> 
> ```
> (gdb) bt
> #0  0x00007ff80ad7b3b3 in KERNELBASE!DebugBreak () from 
> C:\Windows\System32\KernelBase.dll
> #1  0x00007ff6b2f58778 in emacs_abort () at ../../src/w32fns.c:11177
> #2  0x00007ff6b2e22119 in terminate_due_to_signal (sig=11, 
> backtrace_limit=<optimized out>) at ../../src/emacs.c:484
> #3  0x00007ff6b2e44519 in deliver_fatal_thread_signal () at 
> ../../src/sysdep.c:1811
> #4  0x00007ff6b2fbd972 in _gnu_exception_handler 
> (exception_data=0x694ddfbd40) at 
> C:/M/B/src/mingw-w64/mingw-w64-crt/crt/crt_handler.c:213
> #5  0x00007ff80c507ff8 in msvcrt!__C_specific_handler () from 
> C:\Windows\System32\msvcrt.dll
> #6  0x00007ff80d6523df in ntdll!.chkstk () from C:\Windows\SYSTEM32\ntdll.dll
> #7  0x00007ff80d6014a4 in ntdll!RtlRaiseException () from 
> C:\Windows\SYSTEM32\ntdll.dll
> #8  0x00007ff80d650f0e in ntdll!KiUserExceptionDispatcher () from 
> C:\Windows\SYSTEM32\ntdll.dll
> #9  0x00007ff6b2edc652 in XBARE_SYMBOL (a=<optimized out>) at 
> ../../src/lisp.h:1152
> #10 XSYMBOL (a=<optimized out>) at ../../src/lisp.h:1161
> #11 SYMBOL_NAME (sym=<optimized out>) at ../../src/lisp.h:2335
> #12 print_object (obj=<optimized out>, obj@entry=0x193c854e520, 
> printcharfun=0x0, escapeflag=true) at ../../src/print.c:2413
> #13 0x00007ff6b2edec06 in print (obj=obj@entry=0x193c854e520, 
> printcharfun=<optimized out>, escapeflag=escapeflag@entry=true)
>     at ../../src/print.c:1301
> #14 0x00007ff6b2eded28 in Fprin1 (object=0x193c854e520, 
> printcharfun=printcharfun@entry=0x193c3a6b8bd, overrides=overrides@entry=0x0)
>     at ../../src/print.c:776
> #15 0x00007ff6b2edf36b in print_error_message (data=<optimized out>, 
> stream=0x193c3a6b8bd, context=context@entry=0x0, caller=caller@entry=0x0)
>     at ../../src/print.c:1134
> #16 0x00007ff6b2edf5a2 in Ferror_message_string (obj=<optimized out>) at 
> ../../src/print.c:1038
> #17 0x00007fff9fc37d61 in 
> F627974652d636f6d70696c652d7265706f72742d6572726f72_byte_compile_report_error_0
>  ()
>    from 
> d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\bytecomp-12882072-25b12c81.eln
> #18 0x00007ff6b2eb3952 in Ffuncall (nargs=2, args=0x694ddfd818) at 
> ../../src/eval.c:3016
> #19 0x00007fff9fc3f56a in 
> F627974652d636f6d70696c652d66726f6d2d627566666572_byte_compile_from_buffer_0 
> ()
>    from 
> d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\bytecomp-12882072-25b12c81.eln
> #20 0x00007ff6b2eb3952 in Ffuncall (nargs=2, args=0x694ddfd980) at 
> ../../src/eval.c:3016
> #21 0x00007fff9fc3d784 in 
> F627974652d636f6d70696c652d66696c65_byte_compile_file_0 ()
>    from 
> d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\bytecomp-12882072-25b12c81.eln
> #22 0x00007ff6b2eb3952 in Ffuncall (nargs=2, args=0x694ddfdaa0) at 
> ../../src/eval.c:3016
> #23 0x00007fff9fc3c60b in 
> F627974652d7265636f6d70696c652d66696c65_byte_recompile_file_0 ()
>    from 
> d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\bytecomp-12882072-25b12c81.eln
> #24 0x00007ff6b2f00d97 in exec_byte_code (fun=<optimized out>, 
> args_template=<optimized out>, nargs=<optimized out>, 
> nargs@entry=1734276455720,
>     args=<optimized out>, args@entry=0xa0000694ddfdd08) at 
> ../../src/lisp.h:2210
> #25 0x00007ff6b2eb8dab in fetch_and_exec_byte_code (args=0xa0000694ddfdd08, 
> nargs=1734276455720, args_template=<optimized out>, fun=<optimized out>)
>     at ../../src/eval.c:3102
> #26 0x00007ff6b2eb8fa6 in funcall_general (fun=<optimized out>, 
> numargs=numargs@entry=0, args=args@entry=0x694ddfdd08) at 
> ../../src/eval.c:2978
> #27 0x00007ff6b2eb3952 in Ffuncall (nargs=1, args=0x694ddfdd00) at 
> ../../src/eval.c:3016
> #28 0x00007fff9fc3c513 in 
> F627974652d7265636f6d70696c652d6469726563746f7279_byte_recompile_directory_0 
> ()
>    from 
> d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\bytecomp-12882072-25b12c81.eln
> #29 0x00007ff6b2f00d97 in exec_byte_code (fun=<optimized out>, 
> args_template=<optimized out>, nargs=<optimized out>, 
> nargs@entry=1734174478760,
>     args=<optimized out>, args@entry=0x610000694ddfdec8) at 
> ../../src/lisp.h:2210
> #30 0x00007ff6b2eb8dab in fetch_and_exec_byte_code (args=0x610000694ddfdec8, 
> nargs=1734174478760, args_template=<optimized out>, fun=<optimized out>)
>     at ../../src/eval.c:3102
> #31 0x00007ff6b2eb8fa6 in funcall_general (fun=<optimized out>, 
> numargs=numargs@entry=1, args=args@entry=0x694ddfdec8) at 
> ../../src/eval.c:2978
> #32 0x00007ff6b2eb3952 in Ffuncall (nargs=nargs@entry=2, 
> args=args@entry=0x694ddfdec0) at ../../src/eval.c:3016
> #33 0x00007ff6b2ec2077 in call1 (arg1=<optimized out>, fn=0xffff819d10e34f20) 
> at ../../src/lisp.h:3248
> #34 mapcar1 (leni=2, vals=vals@entry=0x0, fn=fn@entry=0xffff819d10e34f20, 
> seq=seq@entry=0x193c872b613) at ../../src/fns.c:3044
> #35 0x00007ff6b2ec475c in Fmapc (function=0xffff819d10e34f20, 
> sequence=0x193c872b613) at ../../src/fns.c:3181
> #36 0x00007ff6b2f00d97 in exec_byte_code (fun=<optimized out>, 
> fun@entry=0x11aa1220, args_template=<optimized out>, nargs=<optimized out>,
>     nargs@entry=1734174522728, args=<optimized out>, 
> args@entry=0xfc0000694ddfe040) at ../../src/lisp.h:2210
> #37 0x00007ff6b2eb8dab in fetch_and_exec_byte_code (args=0xfc0000694ddfe040, 
> nargs=1734174522728, args_template=<optimized out>, fun=0x11aa1220)
>     at ../../src/eval.c:3102
> #38 0x00007ff6b2eb92ae in apply_lambda (fun=0x11aa1220, 
> fun@entry=0x193c4d59e65, args=<optimized out>, count=..., count@entry=...)
>     at ../../src/eval.c:3124
> #39 0x00007ff6b2eb7544 in eval_sub (form=<optimized out>) at 
> ../../src/eval.c:2609
> #40 0x00007ff6b2ee08d5 in readevalloop_eager_expand_eval (val=<optimized 
> out>, macroexpand=macroexpand@entry=0xffff819d10183120)
>     at ../../src/lread.c:2411
> #41 0x00007ff6b2ee07dc in readevalloop_eager_expand_eval (val=0x0, 
> val@entry=0x193c4f123e3, macroexpand=macroexpand@entry=0xffff819d10183120)
>     at ../../src/lisp.h:1498
> #42 0x00007ff6b2ee8fde in readevalloop 
> (readcharfun=readcharfun@entry=0x193c4e3e335, infile0=infile0@entry=0x0,
>     sourcename=sourcename@entry=0x193c430c534, 
> printflag=printflag@entry=false, unibyte=unibyte@entry=0x0, 
> readfun=readfun@entry=0x0,
>     start=start@entry=0x0, end=<optimized out>, end@entry=0x0) at 
> ../../src/lread.c:2595
> #43 0x00007ff6b2eea37f in Feval_buffer (buffer=<optimized out>, 
> printflag=0x0, filename=0x193c430c534, unibyte=0x0, do_allow_print=0x30)
>     at ../../src/lread.c:2668
> #44 0x00007fffee1727ed in 
> F6c6f61642d776974682d636f64652d636f6e76657273696f6e_load_with_code_conversion_0
>  ()
>    from 
> d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\preloaded\mule-3352613d-5a32cafd.eln
> #45 0x00007ff6b2eb7166 in funcall_subr (subr=<optimized out>, 
> numargs=numargs@entry=4, args=args@entry=0x694ddfe918) at 
> ../../src/eval.c:3063
> #46 0x00007ff6b2eb8f20 in funcall_general (fun=<optimized out>, 
> numargs=numargs@entry=4, args=args@entry=0x694ddfe918) at 
> ../../src/eval.c:2962
> #47 0x00007ff6b2eb3952 in Ffuncall (nargs=nargs@entry=5, 
> args=args@entry=0x694ddfe910) at ../../src/eval.c:3016
> #48 0x00007ff6b2ee971c in call4 (arg4=0x30, arg3=0x30, arg2=0x193c430c534, 
> arg1=<optimized out>, fn=<optimized out>) at ../../src/lisp.h:3270
> #49 Fload (file=0x193c430c6b4, noerror=<optimized out>, 
> nomessage=0xffff819d0ff38f08, nosuffix=<optimized out>, 
> must_suffix=<optimized out>)
>     at ../../src/lread.c:1680
> #50 0x00007ff6b2eb7166 in funcall_subr (subr=<optimized out>, 
> numargs=numargs@entry=3, args=args@entry=0x694ddfed50) at 
> ../../src/eval.c:3063
> #51 0x00007ff6b2eb8f20 in funcall_general (fun=<optimized out>, 
> numargs=numargs@entry=3, args=args@entry=0x694ddfed50) at 
> ../../src/eval.c:2962
> #52 0x00007ff6b2eb3952 in Ffuncall (nargs=4, args=0x694ddfed48) at 
> ../../src/eval.c:3016
> #53 0x00007fffee1b528c in 
> F737461727475702d2d6c6f61642d757365722d696e69742d66696c65_startup__load_user_init_file_0
>  ()
>    from 
> d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\preloaded\startup-bbc6ea72-acd89ebf.eln
> #54 0x00007ff6b2eb3952 in Ffuncall (nargs=4, args=0x694ddfee80) at 
> ../../src/eval.c:3016
> #55 0x00007fffee1b72f9 in F636f6d6d616e642d6c696e65_command_line_0 ()
>    from 
> d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\preloaded\startup-bbc6ea72-acd89ebf.eln
> #56 0x00007ff6b2eb3952 in Ffuncall (nargs=1, args=0x694ddfefa8) at 
> ../../src/eval.c:3016
> #57 0x00007fffee1b34e0 in 
> F6e6f726d616c2d746f702d6c6576656c_normal_top_level_0 ()
>    from 
> d:\emacs_home\program\emacs\lib\emacs\30.0.50\native-lisp\30.0.50-580ae89a\preloaded\startup-bbc6ea72-acd89ebf.eln
> #58 0x00007ff6b2eb7b89 in eval_sub (form=form@entry=0x193c38d4903) at 
> ../../src/eval.c:2516
> #59 0x00007ff6b2eba2c2 in Feval (form=0x193c38d4903, lexical=<optimized out>) 
> at ../../src/eval.c:2383
> #60 0x00007ff6b2eb1f6d in internal_condition_case 
> (bfun=bfun@entry=0x7ff6b2e22a30 <top_level_2>, handlers=handlers@entry=0x90,
>     hfun=hfun@entry=0x7ff6b2e2c060 <cmd_error>) at ../../src/eval.c:1486
> #61 0x00007ff6b2e2353d in top_level_1 (ignore=<optimized out>) at 
> ../../src/keyboard.c:1174
> #62 0x00007ff6b2eb1edb in internal_catch (tag=tag@entry=0x10fb0, 
> func=func@entry=0x7ff6b2e23510 <top_level_1>, arg=arg@entry=0x0)
>     at ../../src/eval.c:1209
> #63 0x00007ff6b2e22965 in command_loop () at ../../src/keyboard.c:1134
> #64 0x0000000000000000 in ?? ()
> ```
> 
> This crash does not occur every time the consult package is installed,
> you may have to try multiple times to reproduce it. Remember to delete
> all isntalled packages and eln-caches before you try again.
> 
> After the consult package is installed, `M-x consult-buffer` may trigger
> the crash I mentioned in the last E-mail. However, this one is also not
> reproducible every time the command is executed. You may restart Emacs
> and try again. If you have restarted several times and the crash still
> not present itself, then you may have to reinstall the pacakge.
> 
> Another thing worth noting is that, when I expericen such a crash, if I
> delete the eln-cache for the consult package. Then the next time I start
> Emacs and execute `conult-buffer`, Emacs never crashes. However, it
> generates the eln-cache for that package. If I restart Emacs after that,
> it is likely to crash when I execute `consult-buffer`. I think the crash
> is related with the eln-cache, which also explains why there is no elisp
> error but a crash. I hope this information could be helpful, but you may
> have alredy figured it out.
> 
> If you still can't reprocude the crash, please tell me if there is
> anything else I can do to help.

The above seems to indicate the problems are somehow related to native
compilation.  Can you build Emacs without native-compilation, and try
reproducing this in such an Emacs?  If the problem doesn't happen in
Emacs without native-compilation, I suspect this is a MinGW GCC bug,
not an Emacs bug: the native code in *.eln files is somehow invalid.

Which version of GCC do you have installed, and is libgccjit you have
is from the same GCC version?

Or maybe we have a bug in native compilation.  Andrea, can you try
reproducing this on GNU/Linux?

Another idea is to modify comp.el to have native-comp-speed default to
1 instead of 2, then rebuild Emacs ("make bootstrap") with CFLAGS='-O1',
and see if the problem goes away.  If it does, that again points
toward GCC/libgccjit and the compiler optimizations.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]