Ob-Julia extension crashes Emacs on MacOS
When executing a code block Emacs freezes and gives the following call stack:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow geometry should only be modified on the main thread!'
*** First throw call stack:
(
0 CoreFoundation 0x00007ff807f977e6 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff807a87e9d objc_exception_throw + 48
2 CoreFoundation 0x00007ff807fbb1ac -[NSException raise] + 9
3 AppKit 0x00007ff80b5b0854 -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 235
4 AppKit 0x00007ff80b5bdc67 -[NSThemeFrame _tileTitlebarAndRedisplay:] + 111
5 AppKit 0x00007ff80b5cef12 -[NSTitledFrame _titleDidChange] + 158
6 AppKit 0x00007ff80c0fbf7f -[NSTitledFrame setTitle:subtitle:] + 698
7 AppKit 0x00007ff80b5cebd4 -[NSThemeFrame setTitle:] + 50
8 AppKit 0x00007ff80bc5b9cd -[NSFrameView _updateTitleProperties:animated:] + 53
9 AppKit 0x00007ff80c0eccff -[NSThemeFrame _updateTitleProperties:animated:] + 186
10 CoreFoundation 0x00007ff807f1a130 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 137
11 CoreFoundation 0x00007ff807faab56 ___CFXRegistrationPost_block_invoke + 88
12 CoreFoundation 0x00007ff807faaaa0 _CFXRegistrationPost + 532
13 CoreFoundation 0x00007ff807eea04b _CFXNotificationPost + 682
14 Foundation 0x00007ff808e80d3e -[NSNotificationCenter postNotificationName:object:userInfo:] + 82
15 AppKit 0x00007ff80be54ada -[NSWindowTitleController _propertiesChanged:] + 147
16 AppKit 0x00007ff80b751898 -[NSWindow _setRepresentedURL:] + 94
17 Emacs 0x000000010331bb93 ns_implicitly_set_name + 388
18 Emacs 0x00000001031587e8 gui_consider_frame_title + 711
19 Emacs 0x0000000103156030 redisplay_internal + 1280
20 Emacs 0x00000001031f8968 read_char + 2590
21 Emacs 0x00000001031f6317 read_key_sequence + 1324
22 Emacs 0x00000001031f48ca command_loop_1 + 772
23 Emacs 0x000000010326ef23 internal_condition_case + 86
24 Emacs 0x00000001031f45b4 command_loop_2 + 41
25 Emacs 0x000000010326e812 internal_catch + 80
26 Emacs 0x00000001031f3f7b command_loop + 111
27 Emacs 0x00000001031f3e74 recursive_edit_1 + 142
28 Emacs 0x00000001032230b6 Fread_from_minibuffer + 3752
29 Emacs 0x000000010327be85 Fyes_or_no_p + 561
30 ob-core-cffe1ec4-1d1702a2.eln 0x00000001183af968 F6f72672d626162656c2d636f6e6669726d2d6576616c75617465_org_babel_confirm_evaluate_0 + 664 )
libc++abi: terminating due to uncaught exception of type NSException
Tested with homebrew [email protected] with minimal julia-snail config:
(use-package julia-snail
:config
(setq julia-snail-extensions '(repl-history formatter ob-julia))
(add-to-list 'display-buffer-alist
'("\\*julia" (display-buffer-reuse-window display-buffer-same-window))))
Not much we can do about this type of crash from the Snail side. Does this error occur if you use the same build's terminal Emacs (/Applications/Emacs.app/Contents/MacOS/Emacs -nw or bin/emacs -nw or something along those lines)? What about using a different distribution of Emacs, like the Mac port (https://github.com/railwaycat/homebrew-emacsmacport)?
The issue is related to the julia-snail/ob-julia-interaction-mode. Specifically with the advice around Ctrl-C Ctrl-C. The way I understand it is that this facilitates async execution of code blocks. Removing the advice around org-ctrl-c-ctrl-c makes the execution synchronous, but it ends up working.
The same issues appear with Macports Emacs and Emacs installed with Homebrew.