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

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

bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node


From: Eli Zaretskii
Subject: bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node
Date: Sat, 24 Dec 2022 09:23:32 +0200

> From: Mickey Petersen <mickey@masteringemacs.org>
> Date: Wed, 21 Dec 2022 12:24:34 +0000

Yuan, can you look into this?  The crash is in tree-sitter, so maybe
it isn't our bug, but I'd like to be sure.  And even if it is a
tree-sitter bug, maybe we can work around it to prevent Emacs from
crashing?

> Happens in emacs -Q (after loading some simple elisp code that uses 
> treesit.el) and consistently and repeatedly.
> 
> 
> Here's the elisp. When I edebug it I can step and view all the variables and 
> expressions I like. The `combobulate-' functions are widely used in the 
> library and pose no issues anywhere else and do nothing more than fetch nodes 
> via tree sitter. It is only this bit of code that blows up, and then only 
> when invoked inside a python string.
> 
> 
> 
>     (when-let ((navigable-node (combobulate--get-nearest-navigable-node)) ;; 
> <-- edebugging these work fine;
>                  (nearest-node (combobulate-node-at-point))
>                  (targets (seq-filter
>                            (lambda (elem) (and elem (< elem (point))))
>                            (list (save-excursion (ignore-errors 
> (backward-up-list 1 t t) (point)))
>                                  (combobulate-node-point 
> (combobulate--nav-get-parent navigable-node)) ;; <- call into this inner form 
> blows up when I read the argument value of `navigable-node' on the inside.
>                                  (combobulate-node-point 
> (combobulate--nav-get-parent nearest-node))))))
>         (when-let (target (apply #'max targets))
>           (goto-char target)
>           (combobulate--flash-node 
> (combobulate--get-nearest-navigable-node))))
> 
> Here is the "fix"
> 
>     (when-let* ((navigable-node (combobulate--get-nearest-navigable-node))
>                       (nearest-node (combobulate-node-at-point))
>                       (navigable-node-parent (combobulate--nav-get-parent 
> navigable-node))  ;; <- refactor out 
>                       (nearest-node-parent (combobulate--nav-get-parent 
> nearest-node)) ;; <- refactor out
>                       (targets (seq-filter
>                                 (lambda (elem) (and elem (< elem (point))))
>                                 (list (save-excursion (ignore-errors 
> (backward-up-list 1 t t) (point))) ; <- smoking gun
>                                       (combobulate-node-point 
> navigable-node-parent)
>                                       (combobulate-node-point 
> nearest-node-parent)))))
>             (when-let (target (apply #'max targets))
>               (goto-char target)
>               (combobulate--flash-node 
> (combobulate--get-nearest-navigable-node))))
> 
> Clearly, `ignore-errors' + `backward-up-list' which throws errors left and 
> right if it doesn't like what it's seeing is causing this.
> 
> If I instead of edebugging just run the code, it hangs Emacs. I have to kill 
> -9 it.
> 
> 
> Core dump's half a gig; not going to attach it.
> 
> 
> --- Backtrace from the dump here ---
> 
> #0  raise (sig=<optimised out>) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1  0x000055e6f87a8e21 in terminate_due_to_signal (sig=sig@entry=11, 
> backtrace_limit=-117776184, backtrace_limit@entry=40) at emacs.c:464
> #2  0x000055e6f87a933d in handle_fatal_signal (sig=sig@entry=11) at 
> sysdep.c:1783
> #3  0x000055e6f8901f2d in deliver_thread_signal (sig=sig@entry=11, 
> handler=0x55e6f87a932c <handle_fatal_signal>) at sysdep.c:1775
> #4  0x000055e6f8901fad in deliver_fatal_thread_signal (sig=11) at 
> sysdep.c:1888
> #5  handle_sigsegv (sig=11, siginfo=<optimised out>, arg=<optimised out>) at 
> sysdep.c:1888
> #6  0x00007fb676b683c0 in <signal handler called> () at 
> /lib/x86_64-linux-gnu/libpthread.so.0
> #7  0x00007fb674ea6574 in ts_language_symbol_count () at 
> /usr/local/lib/libtree-sitter.so.0
> #8  0x00007fb674ea6773 in ts_language_symbol_name () at 
> /usr/local/lib/libtree-sitter.so.0
> #9  0x000055e6f8a01ca5 in Ftreesit_node_type 
> (node=node@entry=XIL(0x55e6fdb98f2d)) at treesit.c:1705
> #10 0x000055e6f899ee4d in print_vectorlike
>     (obj=XIL(0x55e6fdb98f2d), printcharfun=XIL(0), escapeflag=<optimised 
> out>, buf=0x7ffe8098a210 "\335M\351\371\346U") at print.c:2040
> #11 0x000055e6f899cb51 in print_object (obj=XIL(0x55e6fdb98f2d), 
> printcharfun=XIL(0), escapeflag=true) at print.c:2612
> #12 0x000055e6f899d42c in Fprin1 (object=XIL(0x55e6fdb98f2d), 
> printcharfun=XIL(0x55e6fd9fcdd5), overrides=<optimised out>) at print.c:777
> #13 0x000055e6f89bc627 in exec_byte_code (fun=<optimised out>, 
> args_template=<optimised out>, nargs=<optimised out>, args=<optimised out>)
>     at lisp.h:2204
> #14 0x000055e6f89735f7 in Ffuncall (nargs=3, args=0x7ffe8098a530) at 
> eval.c:2995
> #15 0x000055e6f8973880 in Fapply (nargs=2, args=0x7fb66f8327a8) at eval.c:2666
> #16 0x000055e6f89bc627 in exec_byte_code (fun=<optimised out>, 
> args_template=<optimised out>, nargs=<optimised out>, args=<optimised out>)
>     at lisp.h:2204
> #17 0x000055e6f89735f7 in Ffuncall (nargs=4, args=0x7ffe8098a680) at 
> eval.c:2995
> #18 0x000055e6f8973880 in Fapply (nargs=3, args=0x7fb66f832700) at eval.c:2666
> #19 0x000055e6f89bc627 in exec_byte_code (fun=<optimised out>, 
> args_template=<optimised out>, nargs=<optimised out>, args=<optimised out>)
>     at lisp.h:2204
> #20 0x000055e6f89735f7 in Ffuncall (nargs=3, args=0x7fb66f832660) at 
> eval.c:2995
> #21 0x000055e6f8973b0a in Fapply (nargs=3, args=0x7fb66f832660) at eval.c:2623
> #22 0x000055e6f89bc627 in exec_byte_code (fun=<optimised out>, 
> args_template=<optimised out>, nargs=<optimised out>, args=<optimised out>)
>     at lisp.h:2204
> #23 0x000055e6f89bc366 in exec_byte_code (fun=<optimised out>, 
> args_template=<optimised out>, nargs=<optimised out>, args=<optimised out>)
>     at bytecode.c:811
> #24 0x000055e6f89735f7 in Ffuncall (nargs=nargs@entry=3, 
> args=args@entry=0x7ffe8098a9f8) at eval.c:2995
> #25 0x000055e6f896f293 in Ffuncall_interactively (nargs=3, 
> args=0x7ffe8098a9f8) at callint.c:248
> #26 0x000055e6f89735f7 in Ffuncall (nargs=4, args=0x7ffe8098a9f0) at 
> eval.c:2995
> #27 0x000055e6f8973880 in Fapply (nargs=nargs@entry=3, 
> args=args@entry=0x7ffe8098ab60) at eval.c:2666
> #28 0x000055e6f8970c57 in Fcall_interactively (function=XIL(0x3a90730), 
> record_flag=XIL(0), keys=XIL(0x55e6fd9f8a6d)) at lisp.h:1171
> #29 0x00007fb6706bdc95 in F636f6d6d616e642d65786563757465_command_execute_0 ()
>     at 
> /home/mickey/Downloads/emacs/src/../native-lisp/30.0.50-7cb43add/preloaded/simple-fab5b0cf-b9ebea66.eln
> #30 0x000055e6f89735f7 in Ffuncall (nargs=nargs@entry=2, 
> args=args@entry=0x7ffe8098ad10) at eval.c:2995
> #31 0x000055e6f88f5ea0 in call1 (arg1=<optimised out>, fn=XIL(0x4c20)) at 
> lisp.h:3247
> #32 command_loop_1 () at keyboard.c:1495
> #33 0x000055e6f8971bf7 in internal_condition_case
>     (bfun=bfun@entry=0x55e6f88f5a80 <command_loop_1>, 
> handlers=handlers@entry=XIL(0x90), hfun=hfun@entry=0x55e6f88e8b60 <cmd_error>)
>     at eval.c:1474
> #34 0x000055e6f88e11ea in command_loop_2 (handlers=handlers@entry=XIL(0x90)) 
> at keyboard.c:1125
> #35 0x000055e6f8971b39 in internal_catch
>     (tag=tag@entry=XIL(0x6b10), func=func@entry=0x55e6f88e11c0 
> <command_loop_2>, arg=arg@entry=XIL(0x90)) at eval.c:1197
> #36 0x000055e6f88e113c in command_loop () at lisp.h:1171
> #37 0x000055e6f88e86b8 in recursive_edit_1 () at keyboard.c:712
> #38 0x000055e6f88e8a60 in Frecursive_edit () at keyboard.c:795
> #39 0x000055e6f89bc627 in exec_byte_code (fun=<optimised out>, 
> args_template=<optimised out>, nargs=<optimised out>, args=<optimised out>)
>     at lisp.h:2204
> #40 0x000055e6f89735f7 in Ffuncall (nargs=3, args=0x7fb66f8323d8) at 
> eval.c:2995
> #41 0x000055e6f8973b0a in Fapply (nargs=3, args=0x7fb66f8323d8) at eval.c:2623
> #42 0x000055e6f89bc627 in exec_byte_code (fun=<optimised out>, 
> args_template=<optimised out>, nargs=<optimised out>, args=<optimised out>)
>     at lisp.h:2204
> #43 0x000055e6f8978c0f in apply_lambda (fun=<optimised out>, args=<optimised 
> out>, count=...) at eval.c:3103
> #44 0x000055e6f8976d4b in eval_sub (form=<optimised out>) at eval.c:2588
> #45 0x000055e6f8978bce in apply_lambda (fun=<optimised out>, args=<optimised 
> out>, count=...) at eval.c:3098
> #46 0x000055e6f8976d4b in eval_sub (form=<optimised out>) at eval.c:2588
> #47 0x000055e6f897862d in Fprogn (body=XIL(0)) at eval.c:436
> #48 funcall_lambda (fun=XIL(0x55e6fc3bf1f3), nargs=0, 
> arg_vector=0x7fb66f832168) at eval.c:3233
> #49 0x000055e6f89bc366 in exec_byte_code (fun=<optimised out>, 
> args_template=<optimised out>, nargs=<optimised out>, args=<optimised out>)
>     at bytecode.c:811
> #50 0x000055e6f8978c0f in apply_lambda (fun=<optimised out>, args=<optimised 
> out>, count=...) at eval.c:3103
> #51 0x000055e6f8976d4b in eval_sub (form=<optimised out>) at eval.c:2588
> #52 0x000055e6f897862d in Fprogn (body=XIL(0)) at eval.c:436
> #53 funcall_lambda (fun=XIL(0x55e6f9db7153), nargs=1, 
> arg_vector=0x7ffe8098b670) at eval.c:3233
> #54 0x000055e6f8978c0f in apply_lambda (fun=<optimised out>, args=<optimised 
> out>, count=...) at eval.c:3103
> #55 0x000055e6f8976d4b in eval_sub (form=<optimised out>) at eval.c:2588
> #56 0x000055e6f8978bce in apply_lambda (fun=<optimised out>, args=<optimised 
> out>, count=...) at eval.c:3098
> #57 0x000055e6f8976d4b in eval_sub (form=<optimised out>) at eval.c:2588
> #58 0x000055e6f897723d in eval_sub (form=<optimised out>) at eval.c:2465
> #59 0x000055e6f8978bce in apply_lambda (fun=<optimised out>, args=<optimised 
> out>, count=...) at eval.c:3098
> #60 0x000055e6f8976d4b in eval_sub (form=<optimised out>) at eval.c:2588
> #61 0x000055e6f897774d in Fand (args=XIL(0)) at eval.c:370
> #62 0x000055e6f8977428 in eval_sub (form=<optimised out>) at lisp.h:2204
> #63 0x000055e6f8979496 in FletX (args=XIL(0x55e6fd7f83c3)) at lisp.h:1522
> #64 0x000055e6f8977428 in eval_sub (form=<optimised out>) at lisp.h:2204
> #65 0x000055e6f8977f97 in Fprog1 (args=XIL(0x55e6fd7f7c13)) at lisp.h:1516
> #66 0x000055e6f8977428 in eval_sub (form=<optimised out>) at lisp.h:2204
> #67 0x000055e6f89797eb in Funwind_protect (args=XIL(0x55e6fd7f7c73)) at 
> lisp.h:1516
> #68 0x000055e6f8977428 in eval_sub (form=<optimised out>) at lisp.h:2204
> #69 0x000055e6f8979235 in Fprogn (body=XIL(0)) at eval.c:436
> #70 Flet (args=<optimised out>) at eval.c:1026
> #71 0x000055e6f8977428 in eval_sub (form=<optimised out>) at lisp.h:2204
> #72 0x000055e6f8979235 in Fprogn (body=XIL(0)) at eval.c:436
> #73 Flet (args=<optimised out>) at eval.c:1026
> #74 0x000055e6f8977428 in eval_sub (form=<optimised out>) at lisp.h:2204
> #75 0x000055e6f8977ef5 in Fprogn (body=XIL(0x55e6fd8a41b3)) at eval.c:436
> #76 prog_ignore (body=XIL(0x55e6fd7f7e03)) at eval.c:447
> #77 Fwhile (args=<optimised out>) at eval.c:1047
> #78 0x000055e6f8977428 in eval_sub (form=<optimised out>) at lisp.h:2204
> #79 0x000055e6f897964d in Fprogn (body=XIL(0)) at eval.c:436
> #80 FletX (args=XIL(0x55e6fd7f7eb3)) at eval.c:958
> #81 0x000055e6f8977428 in eval_sub (form=<optimised out>) at lisp.h:2204
> #82 0x000055e6f897862d in Fprogn (body=XIL(0)) at eval.c:436
> #83 funcall_lambda (fun=XIL(0x55e6fd7f7f93), nargs=1, 
> arg_vector=0x7ffe8098c4e0) at eval.c:3233
> #84 0x000055e6f89735f7 in Ffuncall (nargs=nargs@entry=2, 
> args=args@entry=0x7ffe8098c4d8) at eval.c:2995
> #85 0x000055e6f896f293 in Ffuncall_interactively (nargs=2, 
> args=0x7ffe8098c4d8) at callint.c:248
> #86 0x000055e6f89735f7 in Ffuncall (nargs=nargs@entry=3, 
> args=args@entry=0x7ffe8098c4d0) at eval.c:2995
> #87 0x000055e6f89708d3 in Fcall_interactively (function=<optimised out>, 
> record_flag=<optimised out>, keys=<optimised out>)
>     at callint.c:785
> #88 0x00007fb6706bdc95 in F636f6d6d616e642d65786563757465_command_execute_0 ()
>     at 
> /home/mickey/Downloads/emacs/src/../native-lisp/30.0.50-7cb43add/preloaded/simple-fab5b0cf-b9ebea66.eln
> #89 0x000055e6f89735f7 in Ffuncall (nargs=nargs@entry=2, 
> args=args@entry=0x7ffe8098c7b0) at eval.c:2995
> #90 0x000055e6f88f5ea0 in call1 (arg1=<optimised out>, fn=XIL(0x4c20)) at 
> lisp.h:3247
> #91 command_loop_1 () at keyboard.c:1495
> #92 0x000055e6f8971bf7 in internal_condition_case
>     (bfun=bfun@entry=0x55e6f88f5a80 <command_loop_1>, 
> handlers=handlers@entry=XIL(0x90), hfun=hfun@entry=0x55e6f88e8b60 <cmd_error>)
>     at eval.c:1474
> #93 0x000055e6f88e11ea in command_loop_2 (handlers=handlers@entry=XIL(0x90)) 
> at keyboard.c:1125
> #94 0x000055e6f8971b39 in internal_catch
>     (tag=tag@entry=XIL(0xffc0), func=func@entry=0x55e6f88e11c0 
> <command_loop_2>, arg=arg@entry=XIL(0x90)) at eval.c:1197
> #95 0x000055e6f88e1186 in command_loop () at lisp.h:1171
> #96 0x000055e6f88e86b8 in recursive_edit_1 () at keyboard.c:712
> #97 0x000055e6f88e8a60 in Frecursive_edit () at keyboard.c:795
> #98 0x000055e6f87b23b8 in main (argc=<optimised out>, argv=<optimised out>) 
> at emacs.c:2529
> 
> --- END ---
> 
> 
> 
> In GNU Emacs 30.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
>  3.24.20, cairo version 1.16.0) of 2022-11-29 built on mickey-work
> Repository revision: 7939184f8e0370e7a3397d492812c6d202c2a193
> Repository branch: master
> Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
> System Description: Ubuntu 20.04.3 LTS
> 
> Configured using:
>  'configure --with-native-compilation --with-json --with-mailutils
>  --without-compress-install --with-imagemagick CC=gcc-10'
> 
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
> IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2
> M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
> SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE
> XIM XINPUT2 XPM GTK3 ZLIB
> 
> Important settings:
>   value of $LC_MONETARY: en_GB.UTF-8
>   value of $LC_NUMERIC: en_GB.UTF-8
>   value of $LC_TIME: en_GB.UTF-8
>   value of $LANG: en_GB.UTF-8
>   value of $XMODIFIERS: @im=ibus
>   locale-coding-system: utf-8-unix
> 
> 
> 
> 
> 
> 





reply via email to

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