Skip to content

Conversation

@graebm
Copy link
Contributor

@graebm graebm commented Dec 19, 2022

Issue:
Crashes in aws-crt-python if a WebSocket outlived an EventLoopGroup.

Investigation:
aws_channel is refcounted. It uses an aws_event_loop, but event loops do not currently support refcounting.

The aws_event_loop_group is refcounted, but aws_channel only currently knows about an individual loop.

So it's possible for the refcount on aws_event_loop_group to go to 0, and all the loops are destroyed, before the channel's refcount goes to zero, and it tries to schedule a task on the loop, and everything explodes because the loop was already cleaned up

Description of changes:
Add new function aws_event_loop_group_acquire_hold_on_group(struct aws_event_loop *); so that channel can refcount the group, even though it only has access to the individual loop

I considered adding a proper refcount to individual the aws_event_loop, but there's a good bit of code that assumes the lifetime of the loops is tied to the lifetime of the group, so I didn't want to break that assumption.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2022

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

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.

5 participants