[#79914] [Ruby trunk Bug#13282] opt_str_freeze does not always dedupe — normalperson@...
Issue #13282 has been reported by Eric Wong.
4 messages
2017/03/05
[#80140] [Ruby trunk Feature#13295] [PATCH] compile.c: apply opt_str_freeze to String#-@ (uminus) — shyouhei@...
Issue #13295 has been updated by shyouhei (Shyouhei Urabe).
5 messages
2017/03/13
[#80362] Re: [Ruby trunk Feature#13295] [PATCH] compile.c: apply opt_str_freeze to String#-@ (uminus)
— Eric Wong <normalperson@...>
2017/03/26
shyouhei@ruby-lang.org wrote:
[#80368] Re: [Ruby trunk Feature#13295] [PATCH] compile.c: apply opt_str_freeze to String#-@ (uminus)
— SASADA Koichi <ko1@...>
2017/03/27
On 2017/03/26 15:16, Eric Wong wrote:
[#80205] Re: [ruby-cvs:65166] duerst:r58000 (trunk): clarifiy 'codepoint' in documentation of String#each_codepoint — Eric Wong <normalperson@...>
duerst@ruby-lang.org wrote:
4 messages
2017/03/17
[#80213] Re: [ruby-cvs:65166] duerst:r58000 (trunk): clarifiy 'codepoint' in documentation of String#each_codepoint
— Martin J. Dürst <duerst@...>
2017/03/17
Hello Eric,
[#80290] [Ruby trunk Feature#13355] [PATCH] compile.c: optimize literal String range in case/when dispatch — normalperson@...
Issue #13355 has been reported by normalperson (Eric Wong).
4 messages
2017/03/23
[#80410] Re: [Ruby trunk Feature#13355] [PATCH] compile.c: optimize literal String range in case/when dispatch
— Eric Wong <normalperson@...>
2017/03/27
normalperson@yhbt.net wrote:
[#80415] [Ruby trunk Feature#12589] VM performance improvement proposal — vmakarov@...
Issue #12589 has been updated by vmakarov (Vladimir Makarov).
5 messages
2017/03/28
[#80488] [Ruby trunk Feature#12589] VM performance improvement proposal — vmakarov@...
Issue #12589 has been updated by vmakarov (Vladimir Makarov).
4 messages
2017/03/29
[ruby-core:80453] [Ruby trunk Bug#13106] Timeout does not wait for more than 120 seconds
From:
david.stosik+ruby@...
Date:
2017-03-29 07:13:37 UTC
List:
ruby-core #80453
Issue #13106 has been updated by dstosik (David Stosik).
I think this is not a bug.
It looks like you are catching the `Timeout::Error` raised by `Net::HTTP.get_response`.
Here is a sample code to illustrate this:
~~~ ruby
require 'timeout'
require 'benchmark'
require 'net/http'
puts Benchmark.measure {
begin
Timeout::timeout(250) do
up = false
until up
# my server sleeps, never answers, and triggers a timeout
code = Net::HTTP.get_response(URI.parse("http://localhost:3000/")).code
up = code.eql?("200")
end
end
rescue Timeout::Error => e
puts "Rescued Timeout error: #{e}"
end
}
~~~
And the result:
~~~ text
Rescued Timeout error: Net::ReadTimeout
0.000000 0.000000 0.000000 (120.009394)
~~~
The `Net::ReadTimeout` (which inherits of `Timeout::Error`) was raised by `Net::HTTP.get_response` after 120s waiting, then rescued.
In order for your code to work as you expect it, you need to rescue once from `Timeout::Error` inside `wait_till_app_up` and return `false`. Then you'll be sure that the `Timeout::Error` you rescue at the end of your code comes from your `Timeout::timeout(250) do` block.
----------------------------------------
Bug #13106: Timeout does not wait for more than 120 seconds
https://bugs.ruby-lang.org/issues/13106#change-63945
* Author: 141984 (Gibu John George)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
Hi All,
I have encountered an issue where Timeout does not wait for more than 120 seconds when asked to wait for a greater period.
This is my ruby code, that supposed to wait for 250 seconds to check if an application deployed on tomcat is up or not. As seen in the logs, it exits are 120 seconds.
~~~ ruby
require 'timeout'
require 'socket'
require 'net/http'
ip = '127.0.0.1'
port = '8080'
url = 'http://127.0.0.1:8080/myApp/isUp'
def wait_till_port_open(ip, port)
TCPSocket.new(ip, port).close
puts "#{port} is open"
return true
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL
return false
end
def wait_till_port_close(ip, port)
TCPSocket.new(ip, port).close
puts "#{port} is open"
return false
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRNOTAVAIL
return true
end
def wait_till_app_up(url)
resp_code = Net::HTTP.get_response(URI.parse(url.to_s)).code
if resp_code.eql?('200')
puts 'Application is up'
return true
end
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
return false
end
begin
Timeout::timeout(250) do
until wait_till_port_open(ip, port)
end
end
rescue Timeout::Error
abort("Port #{port} not up after 250 seconds")
end
puts Time.now
begin
Timeout::timeout(250) do
until wait_till_app_up(url)
end
end
rescue Timeout::Error
puts Time.now
abort("Application #{url} not up after 250 seconds")
end
~~~
~~~ text
8080 is open
2017-01-05 13:58:49 +0530
sec : 250 -> added a puts at https://github.com/ruby/ruby/blob/0d74082eced0254a30b8f09a4d65fff357fdc6cd/lib/timeout.rb#L84 to ensure that value is correctly being passed.
2017-01-05 14:00:50 +0530
~~~
Why is this happening? Any fixes for this?
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>