logic-and-learning-lab/Popper

Crash using v1.0.2 (problem with swi-prolog?)

Closed this issue · 5 comments

I just updated to the brand new Popper version v1.0.2 and got the following errors when running any examples:

python3 popper.py examples/alleven 

[Thread 1 (main) at Thu Dec 16 09:42:29 2021] /build/swi-prolog-367kVb/swi-prolog-8.5.3-1-g8692fbe0e/src/pl-fli.c:2556: PL_put_chars: Assertion failed: 0
C-stack trace labeled "assert_fail":
  [0] PL_advance_hash_table_enum() at ??:? [0x7f826fc927a6]
  [1] PL_unify_mpq() at ??:? [0x7f826fc52f80]
  [2] PL_put_chars() at ??:? [0x7f826fc75f08]
  [3] ffi_call_unix64() at ??:? [0x7f8272c46dec]
  [4] ffi_call() at ??:? [0x7f8272c45f55]
  [5] _call_function_pointer() at /home/hakank/python/Python-3.7.6/Modules/_ctypes/callproc.c:850 [0x7f8271cea079]
  [6] PyCFuncPtr_call() at /home/hakank/python/Python-3.7.6/Modules/_ctypes/_ctypes.c:4017 [0x7f8271ce70c3]
  [7] python3(_PyObject_FastCallKeywords+0x92) [0x55aaf779dea2]
  [8] python3(_PyEval_EvalFrameDefault+0x4935) [0x55aaf780ee75]
  [9] python3(+0x1c4658) [0x55aaf7868658]
  [10] python3(+0x16526a) [0x55aaf780926a]
  [11] python3(_PyMethodDef_RawFastCallKeywords+0xe9) [0x55aaf779d529]
  [12] python3(_PyCFunction_FastCallKeywords+0x20) [0x55aaf779d420]
  [13] python3(_PyEval_EvalFrameDefault+0x4643) [0x55aaf780eb83]
  [14] python3(_PyEval_EvalCodeWithName+0x2de) [0x55aaf7809afe]
  [15] python3(_PyFunction_FastCallKeywords+0x1bc) [0x55aaf779f07c]
  [16] python3(_PyEval_EvalFrameDefault+0x49eb) [0x55aaf780ef2b]
  [17] python3(_PyFunction_FastCallKeywords+0xf2) [0x55aaf779efb2]
  [18] python3(_PyEval_EvalFrameDefault+0x517) [0x55aaf780aa57]
  [19] python3(_PyObject_Call_Prepend+0x2db) [0x55aaf779f8fb]
  [20] python3(+0x13aea9) [0x55aaf77deea9]
  [21] python3(+0x137b94) [0x55aaf77dbb94]
  [22] python3(_PyObject_FastCallKeywords+0x92) [0x55aaf779dea2]
  [23] python3(_PyEval_EvalFrameDefault+0x4935) [0x55aaf780ee75]
  [24] python3(_PyFunction_FastCallDict+0x164) [0x55aaf7703464]
  [25] python3(_PyEval_EvalFrameDefault+0x1bc7) [0x55aaf780c107]
  [26] python3(_PyEval_EvalCodeWithName+0x6a3) [0x55aaf7809ec3]
  [27] python3(_PyFunction_FastCallKeywords+0x248) [0x55aaf779f108]
  [28] python3(_PyEval_EvalFrameDefault+0x13ad) [0x55aaf780b8ed]
  [29] python3(_PyFunction_FastCallKeywords+0xf2) [0x55aaf779efb2]
  [30] python3(_PyEval_EvalFrameDefault+0x64d) [0x55aaf780ab8d]
  [31] python3(_PyEval_EvalCodeWithName+0x2de) [0x55aaf7809afe]
  [32] python3(PyEval_EvalCode+0x23) [0x55aaf7809813]
  [33] python3(+0x208f22) [0x55aaf78acf22]
  [34] python3(PyRun_FileExFlags+0x9d) [0x55aaf78ad2ed]
  [35] python3(PyRun_SimpleFileExFlags+0x1b6) [0x55aaf78ad0f6]
  [36] python3(+0x1dfe44) [0x55aaf7883e44]
  [37] python3(_Py_UnixMain+0x3c) [0x55aaf7883adc]
  [38] __libc_start_main() at /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344 [0x7f82743d1bf7]
  [39] python3(_start+0x2a) [0x55aaf78839ba]
[1]    12676 abort (core dumped)  python3 popper.py examples/alleven

What I can interpret of this is that is a problem with SWI-Prolog. I'm using the current verson 8.5.3. Would that be a problem?

My environment:

  • Linux Ubuntu 18.05
  • Python3.7.6
  • Popper is installed via pip3 install -U popper
  • Clingo is installed via pip3 install -U clingo
  • SWI-Prolog vv8.5.3

The import of pyswip is no problem at all. But as soon as I'm trying to use it (the example from https://pypi.org/project/pyswip/), it crashes the same way.

Python 3.7.6 (default, Dec 27 2019, 08:10:34) 
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyswip
>>> from pyswip import Prolog
>>> prolog = Prolog()
>>> prolog.assertz("father(michael,john)")
[Thread 1 (main) at Thu Dec 16 10:18:44 2021] /build/swi-prolog-367kVb/swi-prolog-8.5.3-1-g8692fbe0e/src/pl-fli.c:2556: PL_put_chars: Assertion failed: 0
C-stack trace labeled "assert_fail":
  [0] PL_advance_hash_table_enum() at ??:? [0x7fb9db9457a6]
  [1] PL_unify_mpq() at ??:? [0x7fb9db905f80]
  [2] PL_put_chars() at ??:? [0x7fb9db928f08]
  [3] ffi_call_unix64() at ??:? [0x7fb9dd7cfdae]
  [4] ffi_call() at ??:? [0x7fb9dd7cf71f]
  [5] _call_function_pointer() at /home/hakank/python/Python-3.7.6/Modules/_ctypes/callproc.c:850 [0x7fb9dd9e2079]
  [6] PyCFuncPtr_call() at /home/hakank/python/Python-3.7.6/Modules/_ctypes/_ctypes.c:4017 [0x7fb9dd9df0c3]
  [7] python3(_PyObject_FastCallKeywords+0x92) [0x5577bb0f3ea2]
  [8] python3(_PyEval_EvalFrameDefault+0x4935) [0x5577bb164e75]
  [9] python3(+0x1c4658) [0x5577bb1be658]
  [10] python3(+0x16526a) [0x5577bb15f26a]
  [11] python3(_PyMethodDef_RawFastCallKeywords+0xe9) [0x5577bb0f3529]
  [12] python3(_PyCFunction_FastCallKeywords+0x20) [0x5577bb0f3420]
  [13] python3(_PyEval_EvalFrameDefault+0x4643) [0x5577bb164b83]
  [14] python3(_PyEval_EvalCodeWithName+0x2de) [0x5577bb15fafe]
  [15] python3(_PyFunction_FastCallKeywords+0x1bc) [0x5577bb0f507c]
  [16] python3(_PyEval_EvalFrameDefault+0x49eb) [0x5577bb164f2b]
  [17] python3(_PyEval_EvalCodeWithName+0x2de) [0x5577bb15fafe]
  [18] python3(PyEval_EvalCode+0x23) [0x5577bb15f813]
  [19] python3(+0x208f22) [0x5577bb202f22]
  [20] python3(+0xac0c1) [0x5577bb0a60c1]
  [21] python3(PyRun_InteractiveLoopFlags+0xf0) [0x5577bb0a5d9f]
  [22] python3(+0xab24a) [0x5577bb0a524a]
  [23] python3(+0x587b7) [0x5577bb0527b7]
  [24] python3(_Py_UnixMain+0x3c) [0x5577bb1d9adc]
  [25] __libc_start_main() at /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:344 [0x7fb9df5f9bf7]
  [26] python3(_start+0x2a) [0x5577bb1d99ba]
[1]    14505 abort (core dumped)  python3

The installed pyswip version is the current: 0.2.10 (also installed via pip3).

FYI: I downgrade to pyswipl version 0.2.9 and it seems to work: All programs - the one in the examples and my own - that worked before now work as well. Haven't seen any new issues with this pyswipl version.

I almost expected this: For some of the harder problems, then pyswipl v0.2.9 throws get the old "Too many stacked strings" error. (pyswipl v0.2.10 fixed that problem, if I'm remember correctly.)

Well, I'm quite happy that I can run some Popper programs.