Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FATAL ERROR: Too many stacked strings #102

Closed
vakker opened this issue Aug 27, 2020 · 2 comments · Fixed by #103
Closed

FATAL ERROR: Too many stacked strings #102

vakker opened this issue Aug 27, 2020 · 2 comments · Fixed by #103

Comments

@vakker
Copy link
Contributor

vakker commented Aug 27, 2020

I have a large database (817718 facts) in the form of:

actor(actor_519105,m).
actor(actor_524655,m).
actor(actor_475182,m).
actor(actor_370794,m).
actor(actor_389977,m).
actor(actor_213427,m).
actor(actor_380131,m).
actor(actor_302008,m).
actor(actor_171966,m).
actor(actor_291,m).
...

When I try to run:

from pyswip import Prolog

prolog = Prolog()
prolog.consult('test.pl')
for r in prolog.query('actor(A,_)'):
    print(r)

then is crashes with:

{'A': 'actor_44508'}
{'A': 'actor_60096'}
{'A': 'actor_66141'}
{'A': 'actor_95401'}
....
[FATAL ERROR: at Thu Aug 27 17:32:11 2020
        Too many stacked strings]

Also, if instead of print(r) I just put pass, it crashes as well.

If I do the same in Prolog then is succeeds without any issues:

['test.pl'].
set_prolog_flag(answer_write_options,[max_depth(0)]).
findall(A, actor(A,_), L).

If I use findall in Python, like:

L = list(prolog.query('findall(A, actor(A,_), L)'))[0]['L']
for r in L:
    print(r.value)

then it crashes as well.

With a smaller database this doesn't happen.
Any ideas?

@vakker
Copy link
Contributor Author

vakker commented Sep 1, 2020

I traced the issue to PL_get_chars, which crashes after a large number of query results.
Does that come from libswipl?

Edit:
Yes, and it crashes at this line.

@EricGT
Copy link

EricGT commented Jul 31, 2021

Saw this, don't know if it is relevant but better to have seen it and decide than not.

SWI-Prolog/swipl-devel@ab1a138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants