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

Timeout::timeout inherently unsafe, switch to socket nonblocking io #433

Open
mohamedhafez opened this issue Jan 11, 2021 · 0 comments
Open

Comments

@mohamedhafez
Copy link

mohamedhafez commented Jan 11, 2021

Using Timeout::timeout is inherently unsafe (see https://www.mikeperham.com/2015/05/08/timeout-rubys-most-dangerous-api/ and http://blog.headius.com/2008/02/ruby-threadraise-threadkill-timeoutrb.html), and also inefficient because it spins up a new thread on each invocation.

A better solution would be to switch to all the socket timeout options now available, or to use nonblocking io and IO.select

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

No branches or pull requests

1 participant