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

StackOverflowError for recursion of type a <- b, b <- a #8

Open
thomasrebele opened this issue Oct 14, 2017 · 6 comments
Open

StackOverflowError for recursion of type a <- b, b <- a #8

thomasrebele opened this issue Oct 14, 2017 · 6 comments

Comments

@thomasrebele
Copy link

Hello,

I tried to minimize #7 further. I arrived at

a(X,Y) <- b(X,Y).
b(X,Y) <- a(X,Y).

which leads to a StackOverflowError:

Exception in thread "main" java.lang.StackOverflowError
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateRecursiveOperator(ProgramGenerator.java:1439)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateOperator(ProgramGenerator.java:186)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateOperators(ProgramGenerator.java:249)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateCliqueOperator(ProgramGenerator.java:1616)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateRecursiveOperator(ProgramGenerator.java:1472)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateOperator(ProgramGenerator.java:186)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateOperators(ProgramGenerator.java:249)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateCliqueOperator(ProgramGenerator.java:1616)
...

and then the stack trace repeats again and again

@interesaaat
Copy link
Collaborator

interesaaat commented Oct 15, 2017 via email

@thomasrebele
Copy link
Author

Hi,
thanks for the idea. I tried it with an input relation:

a(X,Y) <- b(X,Y).
b(X,Y) <- a(X,Y).
database({  a(X:string, Y:string) }).

with query b(A,B).

I still get an StackOverflowError, but with a different stack trace:

Exception in thread "main" java.lang.StackOverflowError
	at java.lang.StringBuilder.append(StringBuilder.java:136)
	at edu.ucla.cs.wis.bigdatalog.compiler.predicate.DerivedPredicate.toString(DerivedPredicate.java:43)
	at edu.ucla.cs.wis.bigdatalog.compiler.analysis.BasicClique.toString(BasicClique.java:49)
	at edu.ucla.cs.wis.bigdatalog.compiler.analysis.XYCliqueAnalyzer.isXYClique(XYCliqueAnalyzer.java:338)
	at edu.ucla.cs.wis.bigdatalog.compiler.analysis.XYCliqueAnalyzer.isXYClique(XYCliqueAnalyzer.java:329)
	at edu.ucla.cs.wis.bigdatalog.compiler.analysis.XYCliqueAnalyzer.findXYLiteralType(XYCliqueAnalyzer.java:574)
	at edu.ucla.cs.wis.bigdatalog.compiler.analysis.XYCliqueAnalyzer.findXYRuleType(XYCliqueAnalyzer.java:439)
	at edu.ucla.cs.wis.bigdatalog.compiler.analysis.XYCliqueAnalyzer.isXYClique2(XYCliqueAnalyzer.java:292)
	at edu.ucla.cs.wis.bigdatalog.compiler.analysis.XYCliqueAnalyzer.isXYClique(XYCliqueAnalyzer.java:273)
	at edu.ucla.cs.wis.bigdatalog.compiler.analysis.XYCliqueAnalyzer.isXYClique(XYCliqueAnalyzer.java:347)
	at edu.ucla.cs.wis.bigdatalog.compiler.analysis.XYCliqueAnalyzer.isXYClique(XYCliqueAnalyzer.java:329)
	at edu.ucla.cs.wis.bigdatalog.compiler.analysis.XYCliqueAnalyzer.findXYLiteralType(XYCliqueAnalyzer.java:574)
	at edu.ucla.cs.wis.bigdatalog.compiler.analysis.XYCliqueAnalyzer.findXYRuleType(XYCliqueAnalyzer.java:439)
...

@interesaaat
Copy link
Collaborator

interesaaat commented Oct 15, 2017 via email

@thomasrebele
Copy link
Author

That gives me still another StackOverflowError:

Exception in thread "main" java.lang.StackOverflowError
	at java.util.ArrayList.iterator(ArrayList.java:834)
	at edu.ucla.cs.wis.bigdatalog.compiler.predicate.graph.PCGAndNode.isNonLinearRecursive(PCGAndNode.java:80)
	at edu.ucla.cs.wis.bigdatalog.compiler.recursion.Clique.determineRecursiveType(Clique.java:110)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateCliqueOperator(ProgramGenerator.java:1558)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateRecursiveOperator(ProgramGenerator.java:1472)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateOperator(ProgramGenerator.java:186)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateOperators(ProgramGenerator.java:249)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateCliqueOperator(ProgramGenerator.java:1616)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateRecursiveOperator(ProgramGenerator.java:1472)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateOperator(ProgramGenerator.java:186)
	at edu.ucla.cs.wis.bigdatalog.interpreter.relational.ProgramGenerator.generateOperators(ProgramGenerator.java:249)
...

@interesaaat
Copy link
Collaborator

interesaaat commented Oct 15, 2017 via email

@wangzk
Copy link

wangzk commented Apr 2, 2018

I can reproduce the bug. It is surprise that the relation is that simple.
I also ran this simple program with the author's serial Datalog engine DeALS-0.9.jar and it worked. Therefore, the bug lies on the BigDatalog side.

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

No branches or pull requests

3 participants