Skip to content

convert --to dzi ignores SIGINT/ctx cancellation until the current level finishes (>120s on large NDPI) #25

Description

@cornish

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions