Ctrl-c sometimes leads to a crash
For example, with hexagon.pl from:
https://www.metalevel.at/magon/hexagon.pl
I got a crash when pressing Ctrl-c at a specific (very hard to reproduce) time:
?- magic_hexagon(Vs), labeling([ff], Vs). Vs = [3,17,18,19,7,1,11,16,2,5,6,9,12,4,8,14,10,13,15]a ; Vs = [3,19,16,17,7,2,12,18,1,5,4,10,11,6,8,13,9,14,15] ; thread 'main' panicked at 'index out of bounds: the len is 85694 but the index is 2594073385365418640', src/machine/dispatch.rs:555:24 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
A similar issue was recently noted for a different example in: https://github.com/trealla-prolog/trealla/issues/342#issuecomment-1728916863
I would be extremely grateful for any help with trying to construct an example that more reliably exhibits the crash.
Maybe it is because I have different OS (Ubuntu), or Rust version (1.73.0) used to compile Scryer, but, is it possible that on my computer the "Ctrl-c crash" has a form of: error(existence_error(procedure,do_queue/2),do_queue/2).?
[...] (my ellipsis)
; Vs = [1,2,3,4,5,6,7,9,8,11,12,15,16,13,10,14]
; Vs = [1,2,3,4,5,6,7,9,8,11,12,15,16,13,14,10]
; Vs = [1,2,3,4,5,6,7,9,8,11,12,15,16,14,10,13]
; Vs = [1,2,3,4,5,6,7,9,8,11,12,15,16,14,13,10]
; Vs = [1,2,3,4,5,6,7,9,8,11,12,16,10,13,14,15]
; Vs = [1,2,3,4,5,6,7,9,8,11,12,16,10,13,15,14]
; Vs = [1,2,3,4,5,6,7,9,8,11,12,16,10,14,13,15]
; Vs = [1,2,3,4,5,6,7,9,8,11,12,16,10,14,15,13]
; Vs = [1,2,3,4,5,6,7,9,8,11,12,16,10,15,13,14]
; Vs = [1,2,3,4,5,6,7,9,8,11,12,16,10,15,14,13]
; ^C error('$interrupt_thrown',repl/0).
error(existence_error(procedure,do_queue/2),do_queue/2).
The numbers are my attempt to simplify and "catalyze" (in order to produce the crash) the hexagon.pl example.
Interesting, I would say that this is an unexpected error!
The expected error and toplevel answer when interrupting a computation with Ctrl-c is:
error('$interrupt_thrown',repl/0).
I saw something similar myself recently, the type of panic message upon Ctrl-c:
%@ ; thread 'main' panicked at src/machine/dispatch.rs:554:33:
%@ index out of bounds: the len is 90682 but the index is 8935141660703064304
%@ note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I subsequently failed on multiple attempts to reproduce this panic, however. I attach the code file where this occurred, with comments stripped out — and with a .txt extension to permit upload.
ctrl-c-panic.txt