Skip to content

Conversation

@fumieval
Copy link
Contributor

@fumieval fumieval commented Apr 19, 2019

As described in #396 and #397, sockets can be incorrectly closed during accept or recv. This is because fdSocket doesn't guarantee a reference for the IORef during the operation, letting the Socket to be GC'd.
This MR replaces all the uses of fdSocket with @treeowl 's withFdSocket and ensures that sockets are kept during the actions.

treeowl and others added 2 commits April 19, 2019 17:10
`fdSocket` is fairly unsafe, because the socket may be finalized
(and therefore closed) while the file descriptor is still being
used. `withFdSocket` offers a safer way to use the file descriptor.
@fumieval fumieval changed the title Use withFdSocket whenever possible; deprecate fdSocket Use withFdSocket whenever possible; deprecate fdSocket (fixes #396) Apr 19, 2019
@kazu-yamamoto kazu-yamamoto self-requested a review April 19, 2019 09:28
@eborden
Copy link
Collaborator

eborden commented Apr 19, 2019

@fumieval Could you provide a PR description?

@fumieval fumieval mentioned this pull request Apr 19, 2019
@fumieval
Copy link
Contributor Author

@eborden Sure, updated the description

@kazu-yamamoto
Copy link
Collaborator

My plan is to add a test case first on a new branch, cherry-pick this PR to pass the test and then merge the branch.

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.

4 participants