From 15c129d08790878444f3ecbdef0f8fe15eed06f4 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Tue, 29 Dec 2020 22:02:46 -0800 Subject: [PATCH] Try increasing SMTP's read_timeout for --jit-wait for random hangs like: http://ci.rvm.jp/results/trunk-mjit-wait@phosphorus-docker/3302796 http://ci.rvm.jp/results/trunk-mjit-wait@phosphorus-docker/3302188 http://ci.rvm.jp/results/trunk-mjit-wait@phosphorus-docker/3301293 --- test/net/smtp/test_smtp.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/net/smtp/test_smtp.rb b/test/net/smtp/test_smtp.rb index af30bb7221..e909909dec 100644 --- a/test/net/smtp/test_smtp.rb +++ b/test/net/smtp/test_smtp.rb @@ -29,6 +29,17 @@ module Net end def setup + # Avoid hanging at fake_server_start's IO.select on --jit-wait CI like http://ci.rvm.jp/results/trunk-mjit-wait@phosphorus-docker/3302796 + # Unfortunately there's no way to configure read_timeout for Net::SMTP.start. + if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? + Net::SMTP.prepend Module.new { + def initialize(*) + super + @read_timeout *= 5 + end + } + end + @server_threads = [] end