Skip to content

Propagate cancellation from new-tx scripts instead of committing cancelled ETL #75

Closed

Description

@ejboy

Bug

Cancellation raised inside a new-tx="true" script can be swallowed, causing the ETL executor to report success and commit remaining pending transactions. This pre-existing bug was discovered while verifying connection lifecycle documentation following #19; it is independent of connection caching and does not require reopening #19.

Reproduction and observed behavior

A focused driver reproduction raises EtlCancelledException during script execution after setting the interrupt flag, optionally consuming that flag through EtlCancelledException.checkEtlCancelled().

  • Ordinary scripts propagate cancellation and trigger rollback.
  • With new-tx="true" and close.after.use=false, the executor can report success and commit instead.
  • With close.after.use=true, cancellation is also swallowed when the interrupt flag has already been consumed.
  • If the interrupt flag remains set, a later cancellation check may detect it, but that is not reliable propagation of the original exception.

Expected behavior

Cancellation must propagate to the ETL executor, report isCancelled() == true, attempt rollback of pending transactions, and close connections. Previously committed work and nontransactional output remain subject to existing limitations.

Root cause

TxInterceptor.execute() catches Throwable, attempts rollback of its cached connection, logs the failure, and returns normally. This incorrectly includes EtlCancelledException. checkEtlCancelled() uses Thread.interrupted(), which clears the flag before throwing, so later checks cannot reliably recover cancellation.

Proposed scope and regression scenarios

  • Rethrow cancellation after attempting rollback; rollback errors must not mask the original cancellation.
  • Preserve ordinary new-tx failure behavior: rollback, log, and continue subsequent invocations.
  • Verify cancellation with early closure enabled and disabled, including an already-consumed interrupt flag and rollback failure.
  • Verify pending transactions are rolled back, never committed, and connections are cleaned up.
  • Preserve per-element connection caching, transaction reuse, and normal commit timing.

Target release: 1.7.0.

Activity

  1. added this to the 1.7.0 milestone on Oct 26, 2026
  2. ejboy commented on Nov 3, 2026

    @ejboy
    MemberAuthor

    The fix in dd33b42 propagates cancellation from new-tx scripts. Regression coverage includes a consumed interrupt and rollback failure, and CI plus database compatibility passed. Accepted as complete for 1.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions