Question about adding timeout on RubyTCPSocket#initialize

Hello,

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

To solve this issue, I want to set “timeout” in #initialize on
RubyThread#select.
(Corresponds line 110 of following code)
https://github.com/jruby/jruby/blob/master/src/org/jruby/ext/socket/RubyTCPSocket.java

110 context.getThread().select(channel, this,
SelectionKey.OP_CONNECT);

Is there any idea to solve this problem?

Thanks
Atsushi SAKAI

Hello,

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?

Thanks
Atsushi SAKAI

On Mon, 9 Jul 2012 19:46:54 +0900

Hi SAKAI-san,

In Ruby, you need to use Timeout library like;

require ‘timeout’
sock = nil
timeout(60) do
sock = TCPSocket.new(host, port)
end

So “an freeze error” would not be an error in Ruby.

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

// NaHi