Skip to content

Conversation

@brakhane
Copy link

@brakhane brakhane commented Oct 20, 2021

ASGI specifies that send is a no-op when the connection is closed.

HTTPMiddleware uses anyio streams which will raise
an exception when the connection is closed prematurely.

So we need to ignore the exception in our send function.

Fixes #1284

@brakhane brakhane force-pushed the fix-broken-resource-error branch 4 times, most recently from 41672b2 to b1b384e Compare October 21, 2021 11:57
ASGI specifies that send is a no-op when the connection is closed.

HTTPMiddleware uses anyio streams which will raise
an exception when the connection is closed prematurely.

So we need to ignore the exception in our send function.

Fixes Kludex#1284
@brakhane brakhane force-pushed the fix-broken-resource-error branch from b1b384e to a07b299 Compare October 21, 2021 13:21
@brakhane
Copy link
Author

The failing test seems like a random segmentation fault and I don't think my changes are responsible.

@havardthom havardthom mentioned this pull request Nov 1, 2021
2 tasks
@Kludex
Copy link
Owner

Kludex commented Nov 15, 2021

Hey @brakhane , thanks for PR! 😎

I see this was already solved on #1262, so I'm closing this PR.

@Kludex Kludex closed this Nov 15, 2021
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.

anyio.BrokenResourceError when using BaseHTTPMiddleware

2 participants