Summary
convert --to dzi does not respond promptly to SIGINT / context cancellation.
On a full-size NDPI (ndpi/CMU-1.ndpi), sending SIGINT ~100ms after start does
not terminate the process within 120s — sometimes it runs effectively to
completion. Measured cancel latency in one standalone trial was ~29s; under load
it exceeded 120s.
Cause (suspected)
The parallel DZI pyramid-descent encoders (convert_dzi_descent.go +
libjpeg-turbo workers) appear to check the cancellation context only coarsely
(e.g. between levels / large batches), so an in-flight level — L0 of a big slide
is the expensive one — must finish before cancellation is honored. Cancellation
should be checked per-tile / per-batch so SIGINT terminates within ~1s.
Impact
wsitools convert --to dzi on a large slide can't be interrupted responsively.
TestConvertDZICtxCancel (cmd/wsitools) asserts bounded termination and is
therefore effectively always-failing/flaky; it is skipped pending this fix
(references this issue). Re-enable it once cancellation is prompt.
Fix direction
Thread and check ctx inside the DZI descent's per-tile / per-batch loop (and
the encoder worker pool) so a cancelled context stops scheduling new work and
returns promptly, mirroring how the retile engine honors ctx.
Summary
convert --to dzidoes not respond promptly to SIGINT / context cancellation.On a full-size NDPI (
ndpi/CMU-1.ndpi), sending SIGINT ~100ms after start doesnot terminate the process within 120s — sometimes it runs effectively to
completion. Measured cancel latency in one standalone trial was ~29s; under load
it exceeded 120s.
Cause (suspected)
The parallel DZI pyramid-descent encoders (
convert_dzi_descent.go+libjpeg-turbo workers) appear to check the cancellation context only coarsely
(e.g. between levels / large batches), so an in-flight level — L0 of a big slide
is the expensive one — must finish before cancellation is honored. Cancellation
should be checked per-tile / per-batch so SIGINT terminates within ~1s.
Impact
wsitools convert --to dzion a large slide can't be interrupted responsively.TestConvertDZICtxCancel(cmd/wsitools) asserts bounded termination and istherefore effectively always-failing/flaky; it is skipped pending this fix
(references this issue). Re-enable it once cancellation is prompt.
Fix direction
Thread and check
ctxinside the DZI descent's per-tile / per-batch loop (andthe encoder worker pool) so a cancelled context stops scheduling new work and
returns promptly, mirroring how the retile engine honors ctx.