shivaam opened a new pull request, #74416: URL: https://github.com/apache/airflow/pull/74416
Reusing an `SmtpHook` across two context-manager blocks retains the closed SMTP client and skips connection setup on the second use. This also affects repeated calls to an `SmtpNotifier`, which caches its hook. Clear the client reference when synchronous or asynchronous context cleanup finishes, including when `close()` or `quit()` raises, so the next use reconnects. Cleanup errors still propagate to the caller. Regression tests cover repeated sync/async sends, cleanup failures, and repeated notifications using the notifier's real cached hook. All five new cases fail without the fix. Validation: full SMTP unit suite (59 passed), selected core and provider DB/non-DB regressions (including 299 core and 1,081 provider non-DB passes), hook and all-provider type checks, regular/manual repository hooks, and SMTP/common.compat documentation builds and spell checks. Related setup-failure work is in #74185; this change covers cleanup after context exit. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Codex (GPT-6) Generated-by: Codex (GPT-6) following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
