From: xiewenwei@... Date: 2016-11-16T16:54:31+00:00 Subject: [ruby-core:78176] [Ruby trunk Feature#12928] Use socket conect_timeout in net stdlib for open_timeout Issue #12928 has been updated by xie wenwei. I got it. It is not simple to fix as I expected before. Thank you. ---------------------------------------- Feature #12928: Use socket conect_timeout in net stdlib for open_timeout https://bugs.ruby-lang.org/issues/12928#change-61549 * Author: xie wenwei * Status: Open * Priority: Normal * Assignee: ---------------------------------------- Current net/http and net/pop use Timeout.timeout to tigger open_timeout event. Timeout.timeout is slow. It will create and destroy a thread every time. Timeout.timeout is also dangerous. see [[http://www.mikeperham.com/2015/05/08/timeout-rubys-most-dangerous-api/]] It is more effective and safe to use socket timeout to accomplish this. Follow is the changes need to do. 1. Replace TCPSocket.open with Socket.new 2. Use socket.connect_nonblock and IO.select to connect and trigger timeout event. The pull request is here: [[https://github.com/ruby/ruby/pull/1480]] -- https://bugs.ruby-lang.org/ Unsubscribe: