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

Document that Timeout.timeout and Thread.raise are unsafe operations #60

Closed
wants to merge 1 commit into from

Conversation

jvns
Copy link

@jvns jvns commented Nov 27, 2015

I followed the directions [on the documenting ruby step by step guide](http://documenting-ruby.org/step-by-step-guide.html) -- happy to move this elsewhere if this is the wrong place for this patch.

As discussed in this blog post, Timeout is a dangerous method that can result in really nasty & subtle bugs. Ruby's current documentation says only:

Timeout provides a way to auto-terminate a potentially long-running operation if it hasn’t finished in a fixed amount of time.

which does not indicate that one should be very careful when attempting to use it.

Java documents extensively that using Thread.stop is discouraged, is both in the javadocs for thread.stop and on this page explaining why the method was deprecated

Here's the beginning of the Java documentation for Thread.stop:

Deprecated. This method is inherently unsafe. See stop() for details. An additional danger of this method is that it may be used to generate exceptions that the target thread is unprepared to handle (including checked exceptions that the thread could not possibly throw, were it not for this method). For more information, see Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?.

I'd like to propose that Ruby include a similar warning. this is my first attempt at contributing to Ruby (documentation or otherwise), so very happy to make edits and explain more clearly.

@jvns jvns closed this Sep 9, 2016
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.

1 participant