jupyter
jupyter copied to clipboard
Emacs hangs when unicode entereed to Jupyter REPL (Julia)
Julia allows unicode characters in variables names, like u₀
. If I enter or paste these into a Jupyter REPL, my Emacs hangs at 100% CPU and I have to kill it externally with pkill -9 emacs
.
It's not fully reproducible, but happens often enough that I avoid the REPL altogether. There are no issues with evaluating code that uses unicode characters in Org src blocks, or in buffers associated with the kernel. This seems to be specific to Jupyter REPL.
System info in the "details" below:
emacs version 28.0.50
features XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS PDUMPER LCMS2
build Aug 05, 2020
buildopts (--with-modules)
windowsys x
daemonp server-running
doom version 2.0.9
build grafted, HEAD -> develop, origin/develop, origin/HEAD 00a8f75 2020-08-05 03:32:21 -0400
dir ~/.doom.d/
system type gnu/linux
config x86_64-pc-linux-gnu
shell /bin/bash
uname Linux 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64
path (~/.cargo/bin ~/.nix-profile/bin ~/.guix-profile/bin /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /snap/bin /usr/local/go/bin ~/emacs-src-new/lib-src/)
config envfile envvar-file
elc-files 0
modules (:personal neurosys :completion (company +childframe) (ivy +prescient +childframe) :ui deft doom hl-todo modeline nav-flash zen :editor lispy multiple-cursors word-wrap :emacs dired electric vc :term vterm :checkers syntax :tools direnv (eval +overlay) docker lookup (magit +forge) pass pdf :lang common-lisp data emacs-lisp javascript (haskell +dante) (latex +latexmk +cdlatex) markdown nix (org +journal +hugo +jupyter) rust sh :app calendar :config literate (default +bindings +smartparens))
packages ((ace-window) (aggressive-indent) (company-org-roam :recipe (:host github :repo jethrokuan/company-org-roam)) (company-posframe) (deadgrep) (dired-narrow) (dmenu) (google-this) (helpful) (jest) (key-chord) (org-cliplink) (org-download) (org-drill) (org-noter) (org-recoll :recipe (:host github :repo alraban/org-recoll)) (org-ref) (org-roam :recipe (:host github :repo jethrokuan/org-roam)) (org-roam-bibtex) (org-roam-server) (phi-search) (ob-rust) (real-auto-save) (smartscan) (toc-org) (undo-tree) (wrap-region) (julia-mode :pin 1c122f1dff) (julia-snail) (julia-repl :recipe (:host github :repo tpapp/julia-repl :branch tp/terminal-backends)) (julia-formatter :recipe (:host github :repo ki-chi/julia-formatter)))
unpin (n/a)
elpa (n/a)
Same here, with emacs 27.1 / arch linux 5.10
I think this is also (somehow, god knows how) related to #219. I've found, through some tedious trial and error the most recent time I hit this (entering the seemingly innocuous julia expression x[length(x)÷2:end]
), that pressing C-g exactly 6 times will unlock things and the result of whatever the last input was will display. Here's what I see in *Messages*
after one episode of this:
Error during redisplay: (jit-lock-function 34811) signaled (quit)
Error during redisplay: (jit-lock-function 34812) signaled (quit)
Error during redisplay: (jit-lock-function 34813) signaled (quit)
Error during redisplay: (jit-lock-function 34811) signaled (quit)
Error during redisplay: (jit-lock-function 34812) signaled (quit)
Error during redisplay: (jit-lock-function 34813) signaled (quit)
Every time it prints these 6 lines (although the permutation of the first three seems to vary, the order of the last three is always the same as the first).
With this in mind, I tried disabling font-lock-mode in the jupyter repl buffer, which seems to solve the problem (no more soft-locking after input). Curiously, when I tried re-enabling font-lock-mode, all seems to be well still, even when I enter the same expression again, until I enter another expression with unicode, at which point the same soft-lock resumes...
here's the relevant bit of the profiler report:
- redisplay_internal (C function) 12065 85%
- jit-lock-function 12059 85%
- jit-lock-fontify-now 12059 85%
- jit-lock--run-functions 12059 85%
- run-hook-wrapped 12059 85%
- #<compiled 0x158a0f8d4975> 12058 85%
- font-lock-fontify-region 12058 85%
- #<compiled 0x158a0f21ace9> 12058 85%
- apply 12058 85%
- jupyter-repl-font-lock-fontify-region 12058 85%
- jupyter-repl-map-cells 12057 85%
- #<compiled 0x158a0f8d4945> 12057 85%
- font-lock-default-fontify-region 9753 69%
font-lock-extend-region-multiline 1937 13%
font-lock-extend-region-wholelines 324 2%
+ font-lock-fontify-syntactically-region 3 0%
font-lock-fontify-keywords-region 1 0%
@kleinschmidt Can you try the patch in #308 to see if that fixes things. This does seem to be related to #219 based on your profiler report.
I'll try out the branch and see what shakes out, thanks!