Skip to content

Fix infinite hang when Dremio job is cancelled (CANCELED vs CANCELLED)#322

Open
shanmugapriya5c wants to merge 2 commits into
dremio:mainfrom
shanmugapriya5c:main
Open

Fix infinite hang when Dremio job is cancelled (CANCELED vs CANCELLED)#322
shanmugapriya5c wants to merge 2 commits into
dremio:mainfrom
shanmugapriya5c:main

Conversation

@shanmugapriya5c

Copy link
Copy Markdown

Summary

Fix infinite hang on cancelled Dremio jobs by handling the CANCELED job state (single L)

Description

[DremioCursor._populate_rowcount()] polls Dremio job status in a while True loop and treats FAILED, COMPLETED, and CANCELLED (double L) as terminal states. However, Dremio's REST API returns the American spelling CANCELED (single L) for cancelled jobs — whether cancelled by a user, by the engine (e.g. low memory), or by hitting a workload-management queue timeout.

Because the loop only checked for CANCELLED, a real CANCELED job never matched any terminal branch, so the poller looped forever. dbt never raised, never failed, and never returned — the run hung indefinitely (and, for orchestrators like Dagster/Airflow, the step neither failed nor cancelled). This is reproducible by letting a query exceed its WLM queue timeout, or by cancelling the job from the Dremio Jobs UI.

Reference — Dremio Job API jobState enum (final states are COMPLETED, CANCELED, FAILED): https://docs.dremio.com/cloud/reference/api/job/

Changes in [cursor.py]:

Match both CANCELED and CANCELLED as terminal cancellation states and raise (previously only CANCELLED).
Surface Dremio's cancellationReason in the error message when present (e.g. queue-timeout reason), falling back to "Job was cancelled" for backward compatibility with the existing message.
Updated the stale loop comment (COMPLETE, CANCELLED → COMPLETED, CANCELED).
The fix is intentionally minimal and preserves the existing exception type/message contract.

Test Results

All tests are passing

Changelog

  • Added a summary of what this PR accomplishes to CHANGELOG.md

Contributor License Agreement

Related Issue

NA

@CLAassistant

CLAassistant commented Jun 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants