Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: possible race condition during graceful shutdown #780

Merged
merged 1 commit into from
Mar 30, 2024

Conversation

DDtKey
Copy link
Contributor

@DDtKey DDtKey commented Mar 25, 2024

This PR just makes the behavior more reliable and kinda simplified, also addresses #661 (was able to repro manually and couldn't after the fix)

The possible race condition:

  • notify_waiters() will notify only already registered waiters

Thus, if it's called after

drop(acceptor);
if alive_connections.load(Ordering::Acquire) > 0 {

But before notify.notified() - it might be never notified.

This PR just makes the behavior more reliable, also should address poem-web#661

The possible race condition:
- `notify_waiters()` will notify only already registered waiters

Thus, if it's called after
```rust
drop(acceptor);
if alive_connections.load(Ordering::Acquire) > 0 {
```
But before `notify.notified()` - it might be never notified.
@DDtKey DDtKey mentioned this pull request Mar 25, 2024
@attila-lin
Copy link
Collaborator

I'd love to merge this. What's your opinion? @sunli829

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.

3 participants