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

Resolves an infinite loop when receiving data #182

Merged
merged 1 commit into from
Apr 16, 2016

Conversation

ketzusaka
Copy link
Contributor

Per the system recv API if the other side of the connection returns 0 bytes the peer has performed an orderly shutdown. Because of this, if Hummingbird's receive returns an empty array, that indicates the connection is closed properly. This updates Vapor code to respect that condition and not continue to loop if the peer is closed.

This issue is causing servers to run at full load. Special thanks to linode for alerting me haha.

Per the system recv API if the other side of the connection returns 0 bytes the peer has performed an orderly shutdown. Because of this, if Hummingbird's receive returns an empty array, that indicates the connection is closed properly. This updates Vapor code to respect that condition and not continue to loop if the peer is closed.

This issue is causing servers to run at full load. Special thanks to linode for alerting me haha.
@tanner0101
Copy link
Member

Can you test this against the following command wrk -d10 -c128 -t4 http://localhost:8000/plaintext --header="Connection: keep-alive" and let me know if you get any errors from Vapor.

@ketzusaka
Copy link
Contributor Author

I do get some errors from that, but ab works fine. I'm not sure why there are extra empty lines getting sent in, but I'm investigating some directly with Hummingbird to see how the socket infrastructure works with wrk

@tanner0101 tanner0101 merged commit fc94746 into master Apr 16, 2016
@tanner0101 tanner0101 deleted the ketz/fix-infinite-loop branch April 16, 2016 00:21
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.

None yet

2 participants