anarki icon indicating copy to clipboard operation
anarki copied to clipboard

Anarki hangs when starting on Windows via arc.cmd

Open xenogl opened this issue 2 years ago • 10 comments

When I try to start Anarki via arc.cmd on windows 10, a command prompt opens, but only the blinking cursor is visible and it waits endlessly. Only when I press some key (e.g. space), the text "initializing arc... (may take a minute)" appears. After about 30 seconds the arc prompt appears. But, if I now type something in that prompt (say, number 1) nothing happens, as if repl doesn't work at all. This was tested on Racket version 8.7

xenogl avatar Nov 19 '22 19:11 xenogl

I don't have a solution but I do see similar problems. I'm on Windows 11. I have to press enter, space doesn't help. Then I see an error about not finding collection sha.

akkartik avatar Nov 20 '22 03:11 akkartik

Ah, I forgot the raco pkg install sha

Now I can reproduce the second half of your report as well. And when I hit Ctrl+d I get this error:

char-whitespace?: contact violation
expected: char?
given: #<eof>

akkartik avatar Nov 20 '22 03:11 akkartik

One issue: Racket's (char-ready?) hangs on Windows where it immediately returns on Linux.

There may be others.

akkartik avatar Nov 20 '22 03:11 akkartik

One issue: Racket's (char-ready?) hangs on Windows where it immediately returns on Linux.

There may be others.

How to solve this problem, what shoud I do?

xenogl avatar Nov 20 '22 06:11 xenogl

I'm not sure. I'm not an expert in Windows or Racket. I'm poking at the problem when I have some time. Let's see if others have ideas as well.

I don't see any discussion online that Racket's char-ready? misbehaves on Windows, but I tested it in isolation outside of Anarki and saw the same behavior. Racket's documentation does say:

..byte-ready? and char-ready? are rarely the right choice.

I wonder now if trash-whitespace was just a bad idea. It was introduced in https://github.com/arclanguage/anarki/commit/421c700e6d4605abf2b3f21180b90311f76f668c, and there have only been a couple of changes to it since. I suspect the initial commit.

I'm not at my Windows machine right now, but try deleting this line and see if it helps.

akkartik avatar Nov 20 '22 06:11 akkartik

Though I don't think this explains why it hangs waiting for the initial key. Well, let's fix the second problem first.

akkartik avatar Nov 20 '22 06:11 akkartik

I'm not at my Windows machine right now, but try deleting this line and see if it helps.

Yes, it helps: now I can type in repl. But, i still got that hang on startup, where I have to press enter key first to get initial message "initializing arc... (may take a minute)". I cannot figure out how to fix this.

And second, what keystroke I should use to break back to repl when I want to break some unwanted long computation? (Ctrl-c exit from arc entirely, but i want only to break back to repl)

xenogl avatar Nov 20 '22 06:11 xenogl

I think that ctrl+c might be a known issue..

For the first key, I'd try inserting some prints (display in Racket) between lines in the anarki-windows-cli function in the boot.rkt file. Try to figure out precisely what line causes it to wait for keyboard input.

akkartik avatar Nov 20 '22 07:11 akkartik

I think that ctrl+c might be a known issue..

For the first key, I'd try inserting some prints (display in Racket) between lines in the anarki-windows-cli function in the boot.rkt file. Try to figure out precisely what line causes it to wait for keyboard input.

Something really strange happens here: when I run Anarki from the command line, not via a .cmd file, like this:

c:\Anarki>racket -t boot.rkt -e "(anarki-windows-cli)"

then everything works ok and there is no initial hang.

The problem only appears when Anarki is started via a .cmd file! I don't know how to explain this.

xenogl avatar Nov 20 '22 07:11 xenogl

Wow! Good find.

akkartik avatar Nov 20 '22 07:11 akkartik