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 race between socket close and async calls by stream #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

shaitan
Copy link

@shaitan shaitan commented May 21, 2018

The race leads to crash when streams try to concurrently perform asynchronous operation on closed socket.

@shaitan shaitan added the bug Something isn't working label May 21, 2018
@shaitan shaitan requested a review from karitra May 21, 2018 08:33
Copy link

@karitra karitra left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -55,6 +56,8 @@ class readable_stream:

decoder_type m_decoder;

synchronized<bool> m_stopped{false};
Copy link

Choose a reason for hiding this comment

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

Could be generic std::atomic<bool> more convenient? The same for writable_stream.

Copy link
Author

@shaitan shaitan May 21, 2018

Choose a reason for hiding this comment

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

std::atomic doesn't have RAII scope lock that is used in new code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants