Skip to content

Fix 'asyncio.CancelledError' capturing for 'AioHttpIntegration' - #571

Merged
untitaker merged 4 commits into
getsentry:masterfrom
nikitagashkov:bugfix/aiohttp-integration-cancelled-error
Dec 4, 2019
Merged

untitaker merged 4 commits into
getsentry:masterfrom
nikitagashkov:bugfix/aiohttp-integration-cancelled-error

Conversation

@nikitagashkov

@nikitagashkov nikitagashkov commented Dec 3, 2019 •

Copy link
Copy Markdown
Contributor

This PR disables capturing of asyncio.CancelledError in AioHttpIntegration.

aiohttp will raise asyncio.CancelledError if clients interrupt request (ref.) and this behaviour is considered normal.

In the meanwhile, such aborted requests are getting captured:

Screen Shot 2019-12-03 at 5 35 35 PM

Comment thread sentry_sdk/integrations/aiohttp.py Resolved
@nikitagashkov
nikitagashkov force-pushed the bugfix/aiohttp-integration-cancelled-error branch from 8f76bb8 to df8850a Compare December 3, 2019 15:40
events = capture_events()
client = await aiohttp_client(app)

with suppress(ServerDisconnectedError):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use pytest.raises here unless you are saying this error does not happen all the time

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've used suppress to avoid testing aiohttp here.

At the moment, ServerDisconnectedError is always raised, but this behavior can be changed in the future and will cause tests to fail even though sentry-python operates normally.

But, if you'd like to use pytest.raises instead, let me know :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let's stick with this

@untitaker untitaker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one minor nit left, otherwise g2g

@untitaker
untitaker merged commit 029c647 into getsentry:master Dec 4, 2019
@untitaker

Copy link
Copy Markdown
Member

Thanks!

@nikitagashkov
nikitagashkov deleted the bugfix/aiohttp-integration-cancelled-error branch December 4, 2019 12:48
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.

2 participants