Open radeusgd opened 6 months ago
The null(Internal)
frame also looks a little bit suspicious.
Seems like this may be related to tail call optimizations throwing away some stack frames, tracked in https://github.com/enso-org/enso/issues/9251.
Another related issue might be #8153
Under not-very-clear circumstances (but I've found a reliable repro, I just don't know WHY it's happening), when we get a panic, it is lacking stack frames that should be there. In at least one case this led to a bug that was hard to find because the place where it was being triggered was buried in the missing stack frames.
Repro
This repro is a bit invovled but as for now I could not find a simpler one. Most likely it will only work on Windows, because it relies on the error deleting a file open in another program.
First apply the following patch:
Now create and run the following Enso script:
main = f = File.new "test/Table_Tests/data/transient/out_123.xls" IO.println <| (Table.new [["X", [1,2,3]]]).write f
I have highlighted red two lines between which we are missing some stack frames. We know that the Panic is encountered in our
Spec_Write_Data.teardown
method, and the panic is caused by rethrowing an error returned by a callback withinVector.each
. We can see thePanic.rethrow
(highlighted green), but we don't seeSpec_Write_Data.teardown
norVector.each
frames.Now, to prove that these frames should be there, I will modify the code again. Apply the following patch now:
We essentially replace the
File
error with our own thrown dataflow error. Now run thetest/Table_Tests/src/IO/Excel_Spec.enso
again. This time the stack trace is following:I have highlighted green frames that are now appearing in the stack trace (and red the same frames as in the previous trace). In both scenarios the panic is caused by
Panic.rethrow
rethrowing a dataflow error returned from a callback inVector.each
. So knowing how that works, we know that this part of the stack trace should be the same in both scenarios. Yet, in this scenario we see these frames, but in the one above - we do not.What makes this worst is that the
<enso> Spec_Write_Data.teardown(Excel_Spec.enso:127-128)
frame got dropped making the bug above pretty hard to debug.