Open keyboardDrummer opened 1 year ago
The crash seems to occur because an element of node.LocVars
contains a null
. This could happen even if no actual null is added, if the collection is accessed while an element is being added, given that the definition of Add
updates _size
before adding the item:
public void Add(T item)
{
_version++;
T[] array = _items;
int size = _size;
if ((uint)size < (uint)array.Length)
{
_size = size + 1;
array[size] = item;
}
else
{
AddWithResize(item);
}
}
We could add some debugging code to verify whether this is the issue, but then the next question would be, where is the concurrent access coming from? I would expect a program that is being targeted (by Microsoft.Boogie.Checker.Target
) to already have finished being processed, and not having any changes be made to it.
Next step could be for node.LocVars
to use a custom IList
that can detect a concurrent access and then throws an exception in the thread that's modifying the list (as opposed to the accessing thread for which we already have the stacktrace), so then we know where the modification is coming from.
Problem would still be triggering this instrumentation since the problem occurs very rarely in Dafny's CI tests. I think we might have to put the instrumentation code behind a toggleable option that we turn on in CI, and leave there for a long time.
As @keyboardDrummer referenced it, this issue reappeared recently in another test: https://github.com/dafny-lang/dafny/issues/5396
Run: https://github.com/dafny-lang/dafny/actions/runs/5760643103/job/15617339950?pr=4357