Crash on load_files

Hi, I found a crash:


$ swipl
reading ~/.swiplrc (FS)
Welcome to SWI-Prolog (threaded, 64 bits, version 9.2.2)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

(ins)?- use_module(library(logtalk)).
true.

(ins)?- load_files('$LOGTALKHOME/adapters/swihooks.pl', [expand(true)]).
[Thread 1 (main) at Sat Apr 13 11:55:09 2024] /home/ox_external_source/sources_external/swi-prolog-9.2.2/swipl-9.2.2/src/pl-srcfile.c:1585: endReconsult: Assertion failed: reload->pred_access_count == popNPredicateAccess(0)
C-stack trace labeled "assert_fail":
  [0] save_backtrace() at :? [0x7f47e8c6006e]
  [1] __assert_fail() at :? [0x7f47e8c00566]
  [2] endReconsult() at pl-srcfile.c:? [0x7f47e8beec84]
  [3] pl_fixup_reconsult1_va() at pl-srcfile.c:? [0x7f47e8bef83c]
  [4] PL_next_solution___LD() at :? [0x7f47e8b66687]
  [5] callProlog() at :? [0x7f47e8baee41]
  [6] pl_sig_atomic1_va() at pl-pro.c:? [0x7f47e8baf003]
  [7] PL_next_solution___LD() at :? [0x7f47e8b66687]
  [8] query_loop() at :? [0x7f47e8bae901]
  [9] prologToplevel() at :? [0x7f47e8baf1ad]
  [10] PL_toplevel() at ??:? [0x7f47e8c33b4e]
  [11] swipl(+0x10b5) [0x55b1c8e740b5]
  [12] __libc_start_main() at ./csu/../csu/libc-start.c:308 [0x7f47e8977d0a]
  [13] swipl(+0x10fa) [0x55b1c8e740fa]
Prolog stack:
  [32] system:$fixup_reconsult/1 <foreign>
  [31] system:$load_file/4 [PC=92 in clause 1]
  [30] setup_call_cleanup/3 [PC=5 in clause 1]
  [27] system:$do_load_file_2/5 [PC=221 in clause 1]
  [24] system:$qdo_load_file/4 [PC=10 in clause 1]
  [22] setup_call_cleanup/3 [PC=5 in clause 1]
  [21] system:$c_call_prolog/0 [PC=0 in top query clause]
  [20] system:sig_atomic/1 <foreign>
  [17] system:$load_file/3 [PC=12 in clause 1]
  [11] $toplevel:toplevel_call/1 [PC=3 in clause 1]
  [10] $toplevel:stop_backtrace/2 [PC=4 in clause 1]
  [9] $tabling:$wfs_call/2 [PC=17 in clause 1]
  [7] $toplevel:$execute_goal2/3 [PC=31 in clause 1]
  [5] $toplevel:$query_loop/1 [PC=35 in clause 2]
  [4] setup_call_cleanup/3 [PC=5 in clause 1]
  [3] $toplevel:$query_loop/0 [PC=30 in clause 1]
  [2] $toplevel:$runtoplevel/0 [PC=19 in clause 1]
  [1] $toplevel:$toplevel/0 [PC=3 in clause 1]
  [0] system:$c_call_prolog/0 [PC=0 in top query clause]

Thanks in Advance,
Frank Schwidom

Guess your problem will need Paulo’ attention…

Maybe. I guess is it not intended to import the file like this. But the fact that I get a crash by a c assert call instead of a prolog exception lets me think it is a swi prolog issue.

But in the other hand - is that really the assert call from assert.h when I get a c backtrace and a prolog backtrace in the output?

Indeed. Could be that something invalid is happening, but that should result in a reasonable Prolog exception and message, not a C assertion error.

Yes. On systems where it can it redefines assert() to print more context.

Pushed a fix. Thanks for reporting.

1 Like