Skip to content

Fix BigQueryInsertJobTrigger not propagating CancelledError - #63730

Merged
shahar1 merged 1 commit into
apache:mainfrom
evgeniy-b:fix-bq-trigger-cancelled-error-not-propagated
May 5, 2026
Merged

shahar1 merged 1 commit into
apache:mainfrom
evgeniy-b:fix-bq-trigger-cancelled-error-not-propagated

Conversation

@evgeniy-b

@evgeniy-b evgeniy-b commented Mar 16, 2026 •

Copy link
Copy Markdown
Contributor

The except asyncio.CancelledError block in BigQueryInsertJobTrigger.run() catches the exception to perform cleanup (cancelling the BQ job) but never re-raises it. This causes the cancellation to be silently dropped — the triggerer framework never knows the trigger was cancelled and an error gets logged:

Trigger ... exited without sending an event. Dependent tasks will be failed.


  • Add raise after cleanup to propagate the error.
  • Update tests to assert the exception is raised.

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Opus 4.6

Generated-by: Claude Opus 4.6 following the guidelines

@evgeniy-b
evgeniy-b requested a review from shahar1 as a code owner March 16, 2026 14:25
@boring-cyborg

boring-cyborg Bot commented Mar 16, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: [email protected]
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg Bot added area:providers provider:google Google (including GCP) related issues labels Mar 16, 2026
@potiuk potiuk added the ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green. label Mar 17, 2026
@evgeniy-b

Copy link
Copy Markdown
Contributor Author

@shahar1 , could you please have a look at the pr when you have time?

The `except asyncio.CancelledError` block in `BigQueryInsertJobTrigger.run()`
caught the exception for cleanup but never re-raised it, causing the
cancellation to be silently dropped. The triggerer framework never knew
the trigger was cancelled.

Added `raise` after cleanup to propagate the error. Updated tests to
assert the exception is raised.
@evgeniy-b
evgeniy-b force-pushed the fix-bq-trigger-cancelled-error-not-propagated branch from a38bde7 to 0fd1424 Compare April 30, 2026 09:27
@shahar1
shahar1 merged commit 9b5fa36 into apache:main May 5, 2026
94 checks passed
@boring-cyborg

boring-cyborg Bot commented May 5, 2026

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

potiuk pushed a commit that referenced this pull request Oct 5, 2026
The except asyncio.CancelledError handlers in DataprocSubmitTrigger.run(), DataprocSubmitJobDirectTrigger.run() and DataprocClusterTrigger.run() performed cleanup but never re-raised, so triggerer migration (sibling steals trigger rows, original cancels its coroutines) looked like a crash: Trigger exited without sending an event, failing all dependent deferred tasks. Add the missing bare raise, mirroring the BigQuery fix in #63730, so cancellation propagates and cleanup_finished_triggers takes the transparent-migration path. Update the cancellation tests to require CancelledError instead of also accepting StopAsyncIteration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:google Google (including GCP) related issues ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants