jonathan-laurent/KaTie

Stack overflow

Opened this issue · 3 comments

Given the various branches and fixes in KaTools, I tried checking if the current state of KaTools/master (v4.1-97-gb9248b7) and KaTIE/master ("V0.3", pinned & fetched an hour ago) can read the traces I already have. Unfortunately, I get:

$ KaTie -t trace.json -q testing_query.katie --output-dir testing_query
Evaluating queries: 1 simple and 0 complex
Fatal error: exception Stack overflowssed)
Raised by primitive operation at Stdlib__Hashtbl.find in file "hashtbl.ml", line 541, characters 9-23
Called from Kappa_terms__Instantiation.subst_map_concrete_agent in file "core/term/instantiation.ml", line 256, characters 9-13
Called from Kappa_terms__Instantiation.subst_map_site in file "core/term/instantiation.ml", line 260, characters 12-16
Called from Kappa_terms__Instantiation.subst_map2_agent_in_action in file "core/term/instantiation.ml", line 308, characters 16-38
Called from Stdlib__List.map in file "list.ml", line 92, characters 20-23
Called from Stdlib__List.map in file "list.ml", line 92, characters 32-39
[last line repeats 1018 times]

I believe the line about the overflow, got printed over the "nM events processed", hence the "overflowssed". Probably.

The testing simple query:

query 'test.csv'
match c:{ +b: bCat() }
return {
        'c': time[c],
        'i': agent_id{b}
}

Is this an issue with KaTIE, or KaTools? I.e. should I iterate over KaTools commits until I find one that doesn't error..?

This looks like a KaTools problem indeed. Can you isolate the faulty commit on KaTools?
Also, is this the full stack trace? Is there nothing below [last line repeats 1018 times]?

Ok, so I've tested KaTools commit all the way to the is_agent_id fix, and I'm seeing the same error (just changing the line numbers).

For prior KaTools commits, KaTie won't compile because the edges.is_agent_id call becomes unbound.

I then try to compile KaTie versions that predate this API change, but now the Dune / Opam configuration file is not finalized (e.g. missing a name, not making an building an executable, etc.), so now I'm skeptical that keeping rewinding KaTie's fixes to rewind KaTools' is the right way...

From the error message, this stack overflow is coming from instantiation.ml, line 308, which from the GitBlame view, is not code that has been changed in 7 years. Upstream on the stack is line 260; again not changed in years. Upstream is 256; also not changed in years. And finally the stdlib's hashtb.find, which ... I doubt this is a bug in OCaml's stdlib.

Rather, this looks like a problem resolving a concrete agent following a free operation, which sounds a lot like the side-effect & agent-id issues we've discovered this past month. Does sound like a good lead to you, or am I chasing the wrong goat here?

Ok, I can have a look. Can you push a new test replicating the issue? Is there any issue with the other tests?