Closed owst closed 4 years ago
Yeah can confirm when using www.google.com:81 also it works correctly when doing:
Thread.new do
go("in_threads", 1)
end.join
which should be the same as the parallel call.
... also tried with .each
to simplify further but no luck
reduced it to this:
require 'timeout'
Parallel.each([1], in_threads: 1) do |i|
begin
Timeout.timeout(0.1) { sleep 0.2 }
rescue Timeout::Error
puts "OK"
else
puts "BROKEN"
end
end
problem was introduced here https://github.com/grosser/parallel/pull/251
1.19.2
It appears that setting open_timeout doesn't work if I use
Parallel.map
within_threads
vsin_processes
with aNet::HTTP
request. This came about from me wanting to check the health of various services in parallel (on their private IP addresses), but I'd forgotten to connect my VPN, causing the connection time outs.The following is a standalone reproduction - my default gateway (where
10.0.0.1
is routed) seems to just drop the packets:When I run this, I see:
What causes the difference in Exception raised, and why does the
in_threads
version timeout in ~75 seconds vs ~1 second as was set as the open-timeout?