{"action":"created","issue":{"url":"https://api.github.com/repos/ruby/ruby/issues/1480","repository_url":"https://api.github.com/repos/ruby/ruby","labels_url":"https://api.github.com/repos/ruby/ruby/issues/1480/labels{/name}","comments_url":"https://api.github.com/repos/ruby/ruby/issues/1480/comments","events_url":"https://api.github.com/repos/ruby/ruby/issues/1480/events","html_url":"https://github.com/ruby/ruby/pull/1480","id":188963271,"number":1480,"title":"Fast and safe connect timeout for net","user":{"login":"xiewenwei","id":778284,"avatar_url":"https://avatars.githubusercontent.com/u/778284?v=3","gravatar_id":"","url":"https://api.github.com/users/xiewenwei","html_url":"https://github.com/xiewenwei","followers_url":"https://api.github.com/users/xiewenwei/followers","following_url":"https://api.github.com/users/xiewenwei/following{/other_user}","gists_url":"https://api.github.com/users/xiewenwei/gists{/gist_id}","starred_url":"https://api.github.com/users/xiewenwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiewenwei/subscriptions","organizations_url":"https://api.github.com/users/xiewenwei/orgs","repos_url":"https://api.github.com/users/xiewenwei/repos","events_url":"https://api.github.com/users/xiewenwei/events{/privacy}","received_events_url":"https://api.github.com/users/xiewenwei/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-11-13T10:30:54Z","updated_at":"2016-11-15T17:58:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ruby/ruby/pulls/1480","html_url":"https://github.com/ruby/ruby/pull/1480","diff_url":"https://github.com/ruby/ruby/pull/1480.diff","patch_url":"https://github.com/ruby/ruby/pull/1480.patch"},"body":"net/http, net/pop, net/smtp and net/ftp use `Timeout.timeout` to calculate connect_timeout.\r\nTimeout.timeout is slow. It creates and destroys a thread every time.\r\nTimeout.timeout is also dangerous. see [Timeout: Ruby's Most Dangerous API](http://www.mikeperham.com/2015/05/08/timeout-rubys-most-dangerous-api/)\r\n\r\nIt is more effective and safe to use socket timeout to accomplish that. \r\nFollow is the changes need to do.\r\n1. Replace `TCPSocket.open` with `Socket.tcp`\r\n2. Create `TCPSocket` with `TCPSocket.for_fd`\r\n\r\nredmine issue is here:\r\n[Use socket timeout for net/http and net/pop for open_timeout](https://bugs.ruby-lang.org/issues/12928)"},"comment":{"url":"https://api.github.com/repos/ruby/ruby/issues/comments/260716523","html_url":"https://github.com/ruby/ruby/pull/1480#issuecomment-260716523","issue_url":"https://api.github.com/repos/ruby/ruby/issues/1480","id":260716523,"user":{"login":"xiewenwei","id":778284,"avatar_url":"https://avatars.githubusercontent.com/u/778284?v=3","gravatar_id":"","url":"https://api.github.com/users/xiewenwei","html_url":"https://github.com/xiewenwei","followers_url":"https://api.github.com/users/xiewenwei/followers","following_url":"https://api.github.com/users/xiewenwei/following{/other_user}","gists_url":"https://api.github.com/users/xiewenwei/gists{/gist_id}","starred_url":"https://api.github.com/users/xiewenwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiewenwei/subscriptions","organizations_url":"https://api.github.com/users/xiewenwei/orgs","repos_url":"https://api.github.com/users/xiewenwei/repos","events_url":"https://api.github.com/users/xiewenwei/events{/privacy}","received_events_url":"https://api.github.com/users/xiewenwei/received_events","type":"User","site_admin":false},"created_at":"2016-11-15T17:58:23Z","updated_at":"2016-11-15T17:58:23Z","body":"I changed the codes. Removed TCPSocket.for_fd and used socket directly now."}}
{"actor":{"display_login":"xiewenwei"}}