Skip to content

Fixed KiotaRequestAdapterHook _is_http_client_closed method wrongly returning True when transport was not opened yet#69329

Merged
potiuk merged 1 commit into
apache:mainfrom
dabla:fix/_is_http_client_closed_msgraph
Jul 3, 2026
Merged

Fixed KiotaRequestAdapterHook _is_http_client_closed method wrongly returning True when transport was not opened yet#69329
potiuk merged 1 commit into
apache:mainfrom
dabla:fix/_is_http_client_closed_msgraph

Conversation

@dabla

@dabla dabla commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Fix _is_http_client_closed incorrectly treating a never-opened transport as closed

Problem

KiotaRequestAdapterHook._is_http_client_closed contained a logic error:

# Before
if not transport._has_been_opened and transport.session is None:
    return True  # ← wrong: this means "never used", not "closed"

When the underlying Azure credential AioHttpTransport had never been opened (has_been_opened=False, session=None), the method returned True, signalling that the HTTP client was closed. As a result, get_async_conn discarded and rebuilt the cached RequestAdapter on every invocation even though it was perfectly healthy.

Fix

Return False for this branch — a transport that was never opened is not closed:

# After
if not transport._has_been_opened and transport.session is None:
    return False

This is a follow-up PR on #69128.


Was generative AI tooling used to co-author this PR?
  • [ x ] Yes (please specify the tool below)

Claude Opus 4.6


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

…hat was never opened

When the Azure credential transport had never been opened (_has_been_opened=False,
session=None), _is_http_client_closed incorrectly returned True, causing
get_async_conn to evict and rebuild a perfectly valid cached request adapter on
every call. A never-opened transport is not closed; return False.
@dabla dabla self-assigned this Jul 3, 2026
@potiuk potiuk merged commit bc09d7e into apache:main Jul 3, 2026
82 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants