swipl-devel
swipl-devel copied to clipboard
Sunlock assertion failed
I have the following error when I run my program code:
[Thread 1 (main) at Sun Jan 10 21:42:09 2021] ../src/os/pl-stream.c:369: Sunlock: Assertion failed: 0
C-stack trace labeled "assert_fail":
[0] save_backtrace() at /home/wouter/github/swipl-devel/Debug/../src/os/pl-cstack.c:330 [0x7fcf3e83121e]
[1] __assert_fail() at /home/wouter/github/swipl-devel/Debug/../src/pl-assert.c:103 [0x7fcf3e7cafdd]
[2] Sunlock() at /home/wouter/github/swipl-devel/Debug/../src/os/pl-stream.c:372 [0x7fcf3e8171a2]
[3] releaseStream() at /home/wouter/github/swipl-devel/Debug/../src/os/pl-file.c:446 [0x7fcf3e7ffbef]
[4] streamStatus() at /home/wouter/github/swipl-devel/Debug/../src/os/pl-file.c:1159 [0x7fcf3e8015af]
[5] PL_release_stream() at /home/wouter/github/swipl-devel/Debug/../src/os/pl-file.c:453 [0x7fcf3e7ffc1c]
[6] ar_close() at /home/wouter/github/swipl-devel/Debug/../packages/archive/archive4pl.c:291 [0x7fcf3dc4e2ab]
[7] __archive_rb_tree_remove_node() at ??:? [0x7fcf3d10413e]
[8] __archive_rb_tree_remove_node() at ??:? [0x7fcf3d10431e]
[9] __archive_rb_tree_remove_node() at ??:? [0x7fcf3d1043b0]
[10] __archive_read_free_filters() at ??:? [0x7fcf3d104f8c]
[11] archive_free_handle() at /home/wouter/github/swipl-devel/Debug/../packages/archive/archive4pl.c:192 [0x7fcf3dc4dfc4]
[12] ar_close_entry() at /home/wouter/github/swipl-devel/Debug/../packages/archive/archive4pl.c:1194 [0x7fcf3dc50491]
[13] Sclose() at /home/wouter/github/swipl-devel/Debug/../src/os/pl-stream.c:1949 (discriminator 1) [0x7fcf3e81a34b]
[14] closeStream() at /home/wouter/github/swipl-devel/Debug/../src/os/pl-file.c:1226 [0x7fcf3e8016fd]
[15] closeFiles() at /home/wouter/github/swipl-devel/Debug/../src/os/pl-file.c:1258 [0x7fcf3e8017fc]
[16] dieIO() at /home/wouter/github/swipl-devel/Debug/../src/os/pl-file.c:1197 [0x7fcf3e8015d9]
[17] cleanupProlog() at /home/wouter/github/swipl-devel/Debug/../src/pl-init.c:1467 [0x7fcf3e7bd603]
[18] haltProlog() at /home/wouter/github/swipl-devel/Debug/../src/pl-fli.c:4780 [0x7fcf3e6d0df0]
[19] PL_halt() at /home/wouter/github/swipl-devel/Debug/../src/pl-fli.c:4799 [0x7fcf3e6d0e33]
[20] pl_halt() at /home/wouter/github/swipl-devel/Debug/../src/pl-prims.c:4945 [0x7fcf3e755a4a]
[21] PL_next_solution() at /home/wouter/github/swipl-devel/Debug/../src/pl-vmi.c:4178 [0x7fcf3e6e7b43]
[22] query_loop() at /home/wouter/github/swipl-devel/Debug/../src/pl-pro.c:140 [0x7fcf3e758799]
[23] prologToplevel() at /home/wouter/github/swipl-devel/Debug/../src/pl-pro.c:489 [0x7fcf3e7592d7]
[24] PL_toplevel() at /home/wouter/github/swipl-devel/Debug/../src/pl-fli.c:4747 [0x7fcf3e6d0d9d]
[25] swipl(+0x1201) [0x55a266e85201]
[26] __libc_start_main() at ??:? [0x7fcf3e49fcb2]
[27] swipl(+0x10ee) [0x55a266e850ee]
Aborted (core dumped)
I'm unable to narrow this does to a MWE that I can share here :-( I hope that the stack track by itself is sufficient to find something wrong with the code in the indicated spots.
I've compiled from the latest commit on master.
The error goes away when I remove the code that opens archive streams (archive_data_stream/3). But I need that code to allow arbitrary data files to be processed.
An MWE is not needed badly. Being able to run this under a debugger to examine the state of the program would be nice. It seems some archive is not closed during the run of the program and the associated streams are ultimately closed as the program terminates. I suspect that closeFiles(), not being aware of possible order dependencies for closing, is the root of the problem.
You know my mail address where you can contact me to exchange possible sensitive data to get this reproduced and fixed. Cheers! Jan