It seems these two lines make sense and indicate you are running out of C stack. Or, looking at the assertion failure in stack_avail(), something weird is going on with the C stack. Surely it indeed grows down on X86_64 AFAIK.
It could really be running out of stack or the C stack availability checks are not properly working with JPL. It should not be too hard to figure that out using gdb and/or some print statements in the code trying to verify the C stack availability. If you want others to do that, please make complete source code available, so we can simply run your program and observe its behavior.
If that is supposed to be the code to reproduce, I’m afraid this won’t do. What matters most is probably the Java code and how exactly this uses Prolog. With code, I mean something we can run to reproduce your problem. I think that means the Java code and Prolog code including instructions on how to get it running and reproduce the crash. This looks like something where the details matter.
Thanks. That works and reproduced. Turns out that C-stack protection didn’t work when Prolog engines hop between threads as they do with JPL (and some other not-so-common scenarios). Required some redesign Seems to work fine after commit 15f8cfd92949552b4e16c99723fc53e9fad7a3be to swipl-devel.git.