Uh oh!
There was an error while loading. Please reload this page.
Fix unclosed aiohttp ClientSession in AzureDataFactoryAsyncHook - #60650
Conversation
There was a problem hiding this comment.
Looks good to me. Turning the async hook into a context manager and updating the trigger call sites fixes the aiohttp client leak cleanly. Tests look solid as well.
Not a blocker but I would suggest double checking if there any places outside this file where this hook is being called so that the leak does not persist after your fix.
cruseakshay
commented
Jan 19, 2026
@SameerMesiah97 Double checked other places, looks good. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
dabla
left a comment
There was a problem hiding this comment.
2 small nits but looking good!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
dabla
commented
Jan 22, 2026
@cruseakshay Did you actually tests this changes and can you confirm this works? |
dabla
commented
Jan 22, 2026
@cruseakshay Also, the changes made in the data_factory trigger, like the added _build_trigger_event method like I asked, would be nice to see a test for it as well. Is the trigger data_factory tests also testing the context manger? |
Yes, here are trail logs from latest run |
hook-level test that covers the context manager behavior: |
dabla
commented
Jan 27, 2026
@cruseakshay Thanks for the PR and your patience, good job! |
Uh oh!
There was an error while loading. Please reload this page.
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
…he#60650) * Fix unclosed aiohttp ClientSession in AzureDataFactoryAsyncHook * If cancel_pipeline_run() creates a new connection * Address review comments * review: early return * add tests: build_trigger_event --------- Co-authored-by: Akshay <cruseakshay@users.noreply.github.com>
…he#60650) * Fix unclosed aiohttp ClientSession in AzureDataFactoryAsyncHook * If cancel_pipeline_run() creates a new connection * Address review comments * review: early return * add tests: build_trigger_event --------- Co-authored-by: Akshay <cruseakshay@users.noreply.github.com>
…he#60650) * Fix unclosed aiohttp ClientSession in AzureDataFactoryAsyncHook * If cancel_pipeline_run() creates a new connection * Address review comments * review: early return * add tests: build_trigger_event --------- Co-authored-by: Akshay <cruseakshay@users.noreply.github.com>
…he#60650) * Fix unclosed aiohttp ClientSession in AzureDataFactoryAsyncHook * If cancel_pipeline_run() creates a new connection * Address review comments * review: early return * add tests: build_trigger_event --------- Co-authored-by: Akshay <cruseakshay@users.noreply.github.com>
…he#60650) * Fix unclosed aiohttp ClientSession in AzureDataFactoryAsyncHook * If cancel_pipeline_run() creates a new connection * Address review comments * review: early return * add tests: build_trigger_event --------- Co-authored-by: Akshay <cruseakshay@users.noreply.github.com>
…he#60650) * Fix unclosed aiohttp ClientSession in AzureDataFactoryAsyncHook * If cancel_pipeline_run() creates a new connection * Address review comments * review: early return * add tests: build_trigger_event --------- Co-authored-by: Akshay <cruseakshay@users.noreply.github.com>
…he#60650) * Fix unclosed aiohttp ClientSession in AzureDataFactoryAsyncHook * If cancel_pipeline_run() creates a new connection * Address review comments * review: early return * add tests: build_trigger_event --------- Co-authored-by: Akshay <cruseakshay@users.noreply.github.com>
Closes: #55724
Fix unclosed
aiohttp.ClientSessionandTCPConnectorwarnings when usingAzureDataFactoryRunPipelineOperatorwithdeferrable=True.The
AzureDataFactoryAsyncHookcreates anAsyncDataFactoryManagementClientbut never closes it, causing resource leak errors in logs regardless of pipeline success/failure.Changes
__aenter__,__aexit__, andclose()methods toAzureDataFactoryAsyncHookasync with hook:for proper cleanupFollows the same pattern as #52119 (Databricks fix).
Was generative AI tooling used to co-author this PR?
Generated-by: Claude following the guidelines