Issue #12435 has been reported by Mohamed Hafez.

----------------------------------------
Feature #12435: Using connect_nonblock to open TCP connections in Net::HTTP#connect
https://bugs.ruby-lang.org/issues/12435

* Author: Mohamed Hafez
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
Hey all, I've got a pull request at https://github.com/ruby/ruby/pull/1370 to start using connect_nonblock to open the TCP socket in Net::HTTP#connect, instead of doing a blocking connect that uses Timeout.timeout to look for timeouts. Using connect_nonblock is more efficient since it doesn't involve spinning up a separate thread to watch for timeouts, and also it avoids the race conditions inherent in the use of Timeout.timeout, as detailed in  http://blog.headius.com/2008/02/ruby-threadraise-threadkill-timeoutrb.html

Over the last few versions of ruby there have been analogous fixes accepted to do this for opening an SSL connection in Net::HTTP#connect, so I'm guessing this shouldn't be too controversial, unless there is some issue I'm not aware of that kept the maintainers from implementing this as well...



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>