Skip to content

BDD node limit of 2^^25 reached on Type erasure #19648

Closed
@skavans

Description

@skavans

Hi!

I'm making my own qlpack to make CodeQL support another language. I'm using the Kaleidoscope pack as a sample.

I'm done with AST and making CFG now but, for some reason, after adding a few of ControlFlowTree's, any additional one leads to simple queries like below

select count(AstCfgNode node)

make optimizer hanging while doing something with (some) types, on steps:

Running query: Compiling - Optimising query - Stage 13/14 - Optimising - Type spec
Running query: Compiling - Optimising query - Stage 13/14 - Optimising - Type erasure

Then it leads to the exception:

Oops! A fatal internal error occurred. Details:
com.semmle.util.exception.CatastrophicError: BDD factory #52 QL type universe 'AST#72f56b2e::TAstNode': BDD node limit of 2^^25 reached.
        at com.semmle.bdd.SemmleBDDFactory.growNodesList(SemmleBDDFactory.java:446)
        at com.semmle.bdd.SemmleBDDFactory.makeNode(SemmleBDDFactory.java:396)
        at com.semmle.bdd.SemmleBDDFactory.makeBNode(SemmleBDDFactory.java:423)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDDFactory.and(SemmleBDDFactory.java:689)
        at com.semmle.bdd.SemmleBDD.and(SemmleBDD.java:20)
        at com.semmle.dil.proptypes.BDDProposition.intersect(BDDProposition.java:48)
        at com.semmle.dil.typeinference.TTC.and(TTC.java:207)
        at com.semmle.dil.absinthe.types.TypingFactory$Typing.conjoinTTCs(TypingFactory.java:375)
        at com.semmle.dil.absinthe.types.TypingFactory$Typing.and(TypingFactory.java:404)
        at com.semmle.dil.opt.TypeSpecialiser$ContextCollector.visit(TypeSpecialiser.java:194)
        at com.semmle.dil.opt.TypeSpecialiser$ContextCollector.visit(TypeSpecialiser.java:136)
        at com.semmle.dil.ast.Or.accept(Or.java:108)
        at com.semmle.dil.opt.TypeSpecialiser$ContextCollector.lambda$visit$2(TypeSpecialiser.java:173)
        at java.base/java.lang.Iterable.forEach(Unknown Source)
        at com.semmle.dil.opt.TypeSpecialiser$ContextCollector.visit(TypeSpecialiser.java:168)
        at com.semmle.dil.opt.TypeSpecialiser.apply(TypeSpecialiser.java:70)
        at com.semmle.dil.opt.DILOptimiser.lambda$optimiseDILProgram$12(DILOptimiser.java:303)
        at com.semmle.inmemory.planner.Compiler.lambda$optimiseAndCompileOneProgram$1(Compiler.java:232)
        at com.semmle.dil.opt.DILOptimiser.optimiseDILProgram(DILOptimiser.java:299)
        at com.semmle.dil.opt.DILOptimiser.lambda$apply$0(DILOptimiser.java:63)
        at com.semmle.inmemory.planner.Compiler.lambda$optimiseAndCompileOneProgram$1(Compiler.java:232)
        at com.semmle.dil.opt.DILOptimiser.apply(DILOptimiser.java:53)
        at com.semmle.inmemory.planner.Compiler.optimiseAndCompileOneProgram(Compiler.java:223)
        at com.semmle.inmemory.planner.StageDirector.processStratum(StageDirector.java:167)
        at com.semmle.inmemory.planner.StageDirector.computeStagedProgram(StageDirector.java:121)
        at com.semmle.inmemory.QueryCompiler.prepareQuery(QueryCompiler.java:62)
        at com.semmle.api.QLCompilerUtils.compilePipelineToRa(QLCompilerUtils.java:262)
        at com.semmle.cli2.ql.CompilationCommon$OneCompilation.compileInner(CompilationCommon.java:457)
        at com.semmle.cli2.ql.CompilationCommon$OneCompilation.compile(CompilationCommon.java:273)
        at com.semmle.cli2.ql.CompilationCommon.compile(CompilationCommon.java:241)
        at com.semmle.cli2.ql.CompilationCommon.compile(CompilationCommon.java:233)
        at com.semmle.cli2.execute.ExecuteQueriesCommand.compileOrLoad(ExecuteQueriesCommand.java:827)
        at com.semmle.cli2.execute.ExecuteQueriesCommand$ExecutionIterator.startImpl(ExecuteQueriesCommand.java:224)
        at com.semmle.cli2.execute.ExecuteQueriesCommand$ExecutionIterator.start(ExecuteQueriesCommand.java:192)
        at com.semmle.cli2.execute.ExecuteQueriesCommand$ExecutionIterator.lambda$next$0(ExecuteQueriesCommand.java:187)
        at com.semmle.util.concurrent.FutureUtils.supplyCompose(FutureUtils.java:248)
        at com.semmle.util.concurrent.Paralleliser.lambda$startMoreJobs$3(Paralleliser.java:109)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)

I tried to simplify the Trees, replace them with Leafs, anything. Doesn't make any sense.

Please help me to understand, where to look for the reason? Is it possible to somehow debug this behavior? I do not even understand what "types" it means.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions