Commit 05d0bbc
The periodicity displacement loop advances by an int, so it terminates.
doppler stalled the remote API on the lab's Galaxy A3 after a stop. It is not lock
starvation and not the paused analysis re-running: it is a single analysis pass
that never ends. Measured on the device with a debug build, a watchdog dumping the
stack of any module that runs longer than four seconds:
STUCK in periodicityAM for 22810 ms
at Analysis$periodicityAM.update(Analysis.java:1979)
at PhyphoxExperiment.processAnalysis(PhyphoxExperiment.java:417)
Line 1979 is the innermost loop, and the counter said 346 million iterations and
climbing. Logging the live locals from inside it explains why:
live i=2355 j=12000 x2-i=12045 step=0.0 stepBits=0 iPlusStep=2355
step is the update of the displacement loop, "for (int i = minPeriod;
i < maxPeriod; i += step)". It is declared double and assigned 1 or 2 and nothing
else - yet on that device it reads back as +0.0, bit pattern and all, and
(int)(i + step) is i. So i never advances, the loop cannot end, and since
processAnalysis holds the data lock for the whole module loop, the experiment and
every endpoint that touches buffer data stop with it. The same code with the same
parameters finishes in 1 ms on a desktop JVM, so what produced the zero is below
the source - but the shape is the bug either way: an int counter whose stride is a
double is not guaranteed to advance, and this one only ever wanted 1 or 2.
Making step an int fixes it on the device. The results do not change: with a
user-selected range the stride was already 1, and 2 as an int is what the double 2
truncated to. corpus/analysis/vectors/periodicity/sine-user-range still passes.
This was never only an API stall. doppler filled 4 buffers on the A3 before - all
of them settings constants - and 15 after, because the pass that computes
everything downstream of the periodicity never returned. The experiment was
producing nothing at all on that phone.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 25b6035 commit 05d0bbc
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1965 | 1965 | | |
1966 | 1966 | | |
1967 | 1967 | | |
1968 | | - | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
1969 | 1974 | | |
1970 | 1975 | | |
1971 | 1976 | | |
| |||
0 commit comments