I’m using: SWI-Prolog version 8.1.26
I am compiling the code with > swipl --goal=main -o tester4 -c tester.pl
I want the code to:
Behave the same if executed multiple times with exactly the same input data
But what I’m getting is:
The compiled program sometimes hangs and sometimes (with exactly the same input) does not hang. (I assume it is a memory leak in the generate C-Code.)
This error occurred multiple times when using SWI-Prolog version 8.1.26 under macOS version Mojave 10.14.6. But I could not reproduce the error, when using SWI-Prolog version 8.1.26 under Parallels desktop Windows on the same Mac computer, i.e., compiled under Parallels Windows the code produces always the same correct results.
My code looks like this:
As my code contains the solutions to the assignments for my students, pIease ask for the code via email to stb@upb.de.
You can send the code in a private message. If it can be reproduced and is still relevant (the last fixup tp 8.3 fixed quite a few issues), it is worth a try. Make sure it is complete though, so I can really run it.
Meanwhile, I have also tested the code under opensuse, and I got the same nondeterministic hanging errors as under macOS
(which I could not yet reproduce under Parallels Windows).
Please find attached the .zip-file including the code and 2 screenshots.
Regards,
Stefan Böttcher
(Attachment Code sometimes hanging under macOS.zip is missing)
Same under Ubuntu 20.04. Turns out to be a problem with library(time) in terminating the scheduler thread that is used to signal timeouts. I think the same issue may actually cause alarms and call_with_time_limit/2 not to trigger, although I have seen no evidence that this happens.
Pushed a fix (for the clib submodule). Hope you can deal with just an update to the source?