[ruby-core:113302] [Ruby master Bug#19609] net/http ignores open_timeout, read_timeout on Windows

Issue #19609 has been reported by inversion (Yura Babak). ---------------------------------------- Bug #19609: net/http ignores open_timeout, read_timeout on Windows https://bugs.ruby-lang.org/issues/19609 * Author: inversion (Yura Babak) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt] * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- This small sample works fine on Linux (it takes 2 seconds to finish) but on Windows, it always fails with a timeout after some **magical 21 seconds**. ``` ruby require 'net/http' uri = URI 'http://1.2.3.4' http = Net::HTTP::new(uri.host, uri.port) http.open_timeout = 2 http.read_timeout = 2 time_start = Time.now begin response = http.get uri rescue Exception puts $!.inspect end time_total = Time.now - time_start puts time_total ``` Strange that I have installed different versions and the results are not consistent: **ruby 3.2.2** (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]: ``` #<Net::OpenTimeout: Failed to open TCP connection to 1.2.3.4:80 (execution expired)> 21.0494375 ``` **ruby 3.1.2p20** (2022-04-12 revision 4491bb740a) [x64-mingw-ucrt]: ``` #<Net::OpenTimeout: Failed to open TCP connection to 1.2.3.4:80 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. - user specified timeout)> 2.0190419 # — works as expected ``` **ruby 3.0.1p64** (2021-04-05 revision 0fb782ee38) [x64-mingw32]: ``` #<Net::OpenTimeout: execution expired> 21.0423962 ``` -- https://bugs.ruby-lang.org/
participants (1)
-
inversion (Yura Babak)