pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/encode/httpx/pull/3769

href="https://github.githubassets.com/assets/actions-26401580c700f528.css" /> Ensure mounted transports are closed even if main transport raises by bysiber · Pull Request #3769 · encode/httpx · GitHub
Skip to content

Ensure mounted transports are closed even if main transport raises#3769

Open
bysiber wants to merge 1 commit intoencode:masterfrom
bysiber:fix/ensure-transport-cleanup-on-close
Open

Ensure mounted transports are closed even if main transport raises#3769
bysiber wants to merge 1 commit intoencode:masterfrom
bysiber:fix/ensure-transport-cleanup-on-close

Conversation

@bysiber
Copy link
Copy Markdown

@bysiber bysiber commented Feb 20, 2026

When closing a client with proxy mounts, if the main transport's close()/__exit__() raises an exception, the mounted proxy transports would never be cleaned up. This wraps transport cleanup in try/finally to ensure all transports are properly closed.

Affects Client.close(), Client.__exit__(), AsyncClient.aclose(), and AsyncClient.__aexit__().

When closing a client with proxy mounts, if the main transport's
close/exit raises an exception, the mounted transports would never
be cleaned up. This could lead to leaked connections.

Wrap the main transport cleanup in try/finally to ensure mounted
transports are always properly closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy