Closed DiamondJim87 closed 1 year ago
I'm back from vacation and I'll have a look at this today.
It's not possible that you have a DEPEND_0 which has a DEPEND_0 property? I'm having trouble generating code which shows the bug. I think that would fail earlier and it looks like I have explicit checks for that condition.
Actually I think this Autoplot script shows the same condition:
setScriptDescription('''Try to demo the bug James pointed out. See
https://github.com/das-developers/das2java/issues/68''')
ds= ripplesSpectrogramTimeSeries(100)
xt= xtags(ds)
xt.putProperty(QDataSet.DEPEND_0,xt)
ds.putProperty(QDataSet.DEPEND_0,xt)
#plot(0,ds)
ds.slice(52)
plot(1,ds.slice(52))
The commented-out plot command catches the problem, but ds.slice(52) crashes with the same two lines.
I'll put in a check for this condition, it would be an easy mistake to make. Ideally the xt.putProperty(QDataSet.DEPEND_0,xt) call would fail.
I put a check in org.das2.qds.AbstractDataSet.putProperty to check if a DEPEND_i is set to the dataset itself. This will issue a warning and return without taking any action.
I've put in code which checks to see if DEPEND_i is set to the dataset itself.
The changes to address issue #38 somehow triggers a stack overflow under some circumstances. This is the commit whose (short) hash is 3f666a, and whose summary is "bugfix https://github.com/das-developers/das2java/issues/38: cadence on Juno/WAV/Survey". If you back up to the commit before that, the problem described here does not occur.
I stopped the code in the debugger after one extra recursion so you could see the interesting part of the stack trace. If I continue running at this point, it continues to repeat the top two lines, i.e., the code continues to ping-pong between the two methods DataSetOps.sliceProperties0(...) and DDataSet.slice(...) until the stack overflows.
It will (as usual with us) prove difficult to give you simple code that shows the problem. Here are some of the local variables, which might provide a clue:
I noticed one other oddity I'll mention in case it's relevant. If I run in the debugger but don't set a breakpoint, the debugger halts execution when the stack overflows. Oddly, when this happens, a total of 6 threads seem to hit the same stack overflow. I was surprised that there were multiple threads involved at this point, but maybe that's to be expected.