# Crash on load\_files

**URL:** <https://swi-prolog.discourse.group/t/crash-on-load-files/7369>\
**Category:** Help!\
**Created:** [April 13, 2024, 9:58am UTC](https://swi-prolog.discourse.group/t/crash-on-load-files/7369 "2024-04-13T09:58:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frank\_Schwidom](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/frank_schwidom/32/7662_2.png) [@Frank\_Schwidom](https://swi-prolog.discourse.group/u/Frank_Schwidom)\
**Post date:** [April 13, 2024, 9:58am UTC](https://swi-prolog.discourse.group/t/crash-on-load-files/7369/1 "2024-04-13T09:58:20Z")

</div>

Hi, I found a crash:

```prolog

$ 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

---

<div class="post-metadata">

**Author:** ![CapelliC](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/capellic/32/17_2.png) [@CapelliC](https://swi-prolog.discourse.group/u/CapelliC)\
**Post date:** [April 14, 2024, 2:15pm UTC](https://swi-prolog.discourse.group/t/crash-on-load-files/7369/2 "2024-04-14T14:15:52Z")

</div>

Guess your problem will need Paulo’ attention…

---

<div class="post-metadata">

**Author:** ![Frank\_Schwidom](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/frank_schwidom/32/7662_2.png) [@Frank\_Schwidom](https://swi-prolog.discourse.group/u/Frank_Schwidom)\
**Post date:** [April 15, 2024, 11:36am UTC](https://swi-prolog.discourse.group/t/crash-on-load-files/7369/3 "2024-04-15T11:36:10Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [April 15, 2024, 11:58am UTC](https://swi-prolog.discourse.group/t/crash-on-load-files/7369/4 "2024-04-15T11:58:54Z")

</div>

> [@Frank\_Schwidom](#):
>
> 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.

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

> [@Frank\_Schwidom](#):
>
> is that really the assert call from assert.h when I get a c backtrace and a prolog backtrace in the output?

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

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [April 16, 2024, 7:18pm UTC](https://swi-prolog.discourse.group/t/crash-on-load-files/7369/5 "2024-04-16T19:18:31Z")

</div>

Pushed a fix. Thanks for reporting.
