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

Make reading via TCPConnection re-entrant safe #3175

Merged
merged 2 commits into from
Jun 9, 2019

Conversation

dipinhora
Copy link
Contributor

Port over bc6f78bcaad55156393753c540befe9f581065bc from wallaroo.

There's a nasty possible bug in TCPConnection before
applying this change.

Because _mute and _unmute are synchronous methods on
TCPConnection and because they can be called inside
_pending_reads via code executing in notify.received, its
possible to mute and unmute a source while executing
_pending_reads.

Prior to this change, if you were to unmute from inside a pending
reads via the above scenario, _unmute would synchronously call
_pending_reads to re-enter that function and start processing
data out of order. Further, we could end up in an infinite loop
so long as enough data existed.

Port over bc6f78bcaad55156393753c540befe9f581065bc from wallaroo.

There's a nasty possible bug in TCPConnection before
applying this change.

Because `_mute` and `_unmute` are synchronous methods on
TCPConnection and because they can be called inside
`_pending_reads` via code executing in `notify.received`, its
possible to mute and unmute a source while executing
`_pending_reads`.

Prior to this change, if you were to unmute from inside a pending
reads via the above scenario, `_unmute` would synchronously call
`_pending_reads` to re-enter that function and start processing
data out of order. Further, we could end up in an infinite loop
so long as enough data existed.
dipinhora added a commit to dipinhora/ponyc that referenced this pull request Jun 9, 2019
@SeanTAllen SeanTAllen merged commit c0d8f8a into ponylang:master Jun 9, 2019
patches11 pushed a commit to patches11/ponyc that referenced this pull request Jun 29, 2019
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