Open maruks opened 1 month ago
Although I don't yet have any idea what's happening, as an initial quick experiment we could try running the Racket Mode back end directly.
The shell command to run it is basically:
$ racket main.rkt --use-svg
where
racket
for you seems to be /Applications/Racket\ v8.14/bin/racket
main.rkt
seems to be /Users/maris/.emacs.d/elpa/racket-mode-20240923.1416/racket/main.rkt
.So at the shell prompt:
$ /Applications/Racket\ v8.14/bin/racket /Users/maris/.emacs.d/elpa/racket-mode-20240923.1416/racket/main.rkt --use-svg
It might take 5 seconds or so for Racket to load this, then the Racket Mode back end should print:
(ready )
At this point you can pretend to be the Emacs front end of Racket Mode, and enter commands and see responses.
Try typing the following and hit ENTER:
(1 nil path)
It should instantly print a response like this (though the path will differ for you):
(1 ok "/home/greg/src/elisp/racket-mode/racket/" )
Then you can just C-c out of it.
Does all that work for you in a macOS shell?
How about in an M-x shell
Emacs shell?
Some other debugging ideas/comments:
M-x switch-buffer
and enter racket-back-end-/
-- note the leading space in that buffer name, which means Emacs tends to hide it. Does the buffer look empty, or is there any text "stuck" in it?
There are a couple commands you shouldn't need to use (unless you hack on Racket Mode like me), but FYI:
M-x racket-stop-back-end
will stop the back end, if running, and let something try to restart it on demand.M-x racket-start-back-end
will start the back end (if already running it will stop it first, i.e. restart).For a plain old local back end, Emacs is just running a process and using a plain old pipe for I/O. Various Racket Mode commands go to the back end's input, and the back end outputs command responses and various unsolicited notifications, which end up in that racket-back-end-/
buffer until the front end processes them. The "wire protocol" is Emacs s-expressions.
Of course the word "just" does a lot of work in that sentence, but typically this has worked without any drama for many years. I wonder what's going on, here! I'm sorry you're having a problem but I'm interested in figuring this out!
FWIW I'm also using Emacs 29.4, albeit built for Linux.
Although I have a Mac for testing, it's not yet upgraded to Sequoia. I will try that myself, but it may take me a day or two to find time to do the upgrade process etc.
Different user here having the same issue, with a very similar software setup (critically, including the macOS Sequoia part).
- Does all that work for you in a macOS shell?
I get the (ready )
, but after entering (1 nil path)
it hangs at 100% CPU usage (and doesn't respect ctrl+c).
@distractedlambda Although I think you were clear, just to make sure: Is that symptom when you try in Terminal.app? Or Emacs *shell*
buffer? Or both?
Unfortunately I can't reproduce this on macOS Monterrey, which is the newest this 2017 Macbook 9,1 can take.
Using Terminal.app (with 1. Racket 8.14 installed, and, 2. git clone of this project to ~/src/elisp/racket-mode
):
Gregs-Macbook:~ /Applications/Racket_v8.14/bin/racket /Users/greg/src/elisp/racket-mdoe/racket/main.rkt --use-svg
(ready ) # output
(1 nil path) # my input
(1 ok "/Users/greg" ) # output
and C-c works to exit.
@distractedlambda I think this is equivalent to what you're doing -- but you don't get the (1 ok ___)
response and C-c doesn't work. Correct?
On startup, it does use delay/thread
to do load-collections-xref
and make-blueboxes-cache
.
Otherwise, it goes into a main command loop where it reads an Emacs Lisp s-expression from stdin, and uses a fresh thread to run each command.
I'm trying to imagine how macOS Sequoia per se would change something in Racket itself to make this behave differently? Would that in fact be an issue in Racket 8.14 itself??
Although I'm willing to buy a newer-enough MacBook Air or Mini to run Sequoia, I probably can't within the next few days. :disappointed:
I get this on a 2019 Intel Mac running Sequoia.
% /Applications/Racket\ v8.14.0.4/bin/racket racket-mode/racket/main.rkt --use-svg
(ready )
(1 nil path)
(1 ok "/Users/soegaard/tmp/" )
(logger "[ debug] racket-mode: 0 cpu | 0 real | 0 gc :: '(1 \"*\" (path))\n" )
^Cuser break
context...:
/Users/soegaard/tmp/racket-mode/racket/command-server.rkt:64:0: command-server-loop
body of (submod "/Users/soegaard/tmp/racket-mode/racket/main.rkt" main)
Note: I used the snapshot version from today and this fix.
https://github.com/racket/gui/commit/d8ee912321da958a5a9eec7eee27a5f93dd4d1bd
I realized that I also have 8.14.0.2 installed. Here I see the same behavior as @distractedlambda .
I'm using an ARM Mac FWIW, but this is definitely sounding like a Sequoia issue.
I'll try a snapshot build of Racket when I get some time to do so (may not be today).
@soegaard Brilliant thank you so much.
So IIUC @distractedlambda and @maruks you can resolve this by using, not the Racket 8.14 release, but a snapshot from today 2024-09-24 or later.
Next Racket release might be an 8.14.1 update, or 8.15 in some months.
thank you, snapshot version works for me
Already the back end checks early for the Racket version, and exits if not at least a minimum supported (currently 6.12).
It occurred to me I could add a check for running on macOS Sequoia 15.0 or newer, and in that case require at least Racket 8.14.04.
So I merged that. Although I couldn't test on Sequoia, I tested on Sonoma and saw the correct version string. So I think this is safe; I don't want to be too clever and have it backfire. Assuming it works correctly people should get some clear early feedback. Also I'll tag this issue with "FAQ" and pin it, for awhile.
Just for completeness, I can confirm that today's snapshot version works for me as well.
FWIW The fix in
https://github.com/racket/gui/commit/d8ee912321da958a5a9eec7eee27a5f93dd4d1bd
simply moves the definition of wake-evt
and socket_callback
up before they are used.
This fix also works on Racket 8.12.
FWIW The fix in
simply moves the definition of
wake-evt
andsocket_callback
up before they are used.This fix also works on Racket 8.12.
Good to know. So if someone wants to "backport" this, they can do so -- even in a very casual way by finding that file, editing it, and saving it. It would be nice to raco make
that, for speed, but not strictly necessary. Caveat: I say this based on past experience making such casual, experimental hacks -- but I haven't tried this one specifically. Of course there are less-casual ways involving git and applying patches, to get the same result.
Same problem (Emacs, racket-mode, ARM, Sequoia 15.0.1), below.
But now it's 10/24, I no longer see snapshot from today 2024-09-24 or later, but racket-8.15.0.2.
Is it ok to just run 8.15.0.2 or is there a way for me to hunt-down 18.14.02 ... or are they actually the same thing ... :)
Thanks TT
{racket-back-end-/-stderr} internal error: attempt to deschedule the current thread in atomic mode context...: /opt/homebrew/Cellar/minimal-racket/8.14/share/racket/collects/racket/system.rkt:174:0: do-system*/exit-code /Users/tomtitchener/.emacs.d/elpa/racket-mode-20241018.1545/racket/main.rkt:22:0: macos-sequoia-or-newer? /Users/tomtitchener/.emacs.d/elpa/racket-mode-20241018.1545/racket/main.rkt:34:2 body of (submod "/Users/tomtitchener/.emacs.d/elpa/racket-mode-20241018.1545/racket/main.rkt" main)
As far as I know you simply need any version of Racket that is at least 8.14.04. The 8.15.0.2 snapshot should be fine.
The 8.15 official release is coming soon (some small number of weeks, AFAIK?), which should also be fine.
Got it, many thanks! This is a dynamite package, especially with emacs integration.
Hello
I am using Emacs 29.4, racket-mode 20240923.1416 and racket v8.14 on Mac OSX Sequoia 15.0. It looks like my Emacs has trouble communicating with racket backend.
I can't open Repl. M-x racket-repl / M-x racket-run-and-switch-to-repl opens an empty buffer.
This error appears in Messages
eldoc error: (error Command (type namespace "") from #<buffer *Racket REPL </>*> to "racket-back-end-/" timed out after 10 seconds) [2 times]
Racket-xp-mode is stuck in running mode. It always shows lambda ( "Getting analysis from Racket Mode back-end and annotating" ).
I can see backend process running:
/Applications/Racket v8.14/bin/racket /Users/maris/.emacs.d/elpa/racket-mode-20240923.1416/racket/main.rkt --use-svg
Config:
Please copy all of the following lines and paste them into your bug report at https://github.com/greghendershott/racket-mode/issues/.
Package
System values
Buffer values
Racket Mode values
Minor modes
Disabled minor modes
Steps to reproduce: