Forum: JRuby Question about adding timeout on RubyTCPSocket#initialize

85d05f3a16f4efd3d833e3a9c999966d?d=identicon&s=25 Atsushi SAKAI (Guest)
on 2012-07-09 12:48
(Received via mailing list)

 I met an freeze error on RubyTCPSocket#initialize.
The problem is that RubyThread#select never returns, which is used in

To solve this issue, I want to set "timeout" in #initialize on
(Corresponds line 110 of following code)

110                context.getThread().select(channel, this,

Is there any idea to solve this problem?

Atsushi SAKAI
85d05f3a16f4efd3d833e3a9c999966d?d=identicon&s=25 Atsushi SAKAI (Guest)
on 2012-07-10 13:01
(Received via mailing list)

 My request is something like attached patch.
The problem is #initialize does not have argument "timeout".
How should I treat about timeout? fixed value is OK?

Atsushi SAKAI

On Mon, 9 Jul 2012 19:46:54 +0900
6c06915d9aa00cd5c7d4acfb27cdd4e9?d=identicon&s=25 Hiroshi Nakamura (Guest)
on 2012-07-20 01:55
(Received via mailing list)
Hi SAKAI-san,

In Ruby, you need to use Timeout library like;

require 'timeout'
sock = nil
timeout(60) do
  sock =, port)

So "an freeze error" would not be an error in Ruby.

Can you show us the actual error (with stacktrace) you got?

// NaHi
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.