Seeing ConnectionPendingException in my code
--------------------------------------------

                 Key: JRUBY-5594
                 URL: http://jira.codehaus.org/browse/JRUBY-5594
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.6
            Reporter: Mike Perham
            Assignee: Thomas E Enebo


This ruby code appears to be leaking a native java exception?

{{
      def self.open(host, port, options = {})
        # All this ugly code to ensure proper Socket connect timeout
        addr = Socket.getaddrinfo(host, nil)
        sock = new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0)
        sock.options = { :host => host, :port => port }.merge(options)
        begin
          sock.connect_nonblock(Socket.pack_sockaddr_in(port, addr[0][3]))
        rescue Errno::EINPROGRESS
          resp = IO.select(nil, [sock], nil, options[:timeout])
          begin
            sock.connect_nonblock(Socket.pack_sockaddr_in(port, addr[0][3]))
          rescue Errno::EISCONN
          end
        end
        sock
      end
}}

java.nio.channels.ConnectionPendingException
        at 
sun.nio.ch.SocketChannelImpl.ensureOpenAndUnconnected(SocketChannelImpl.java:469)
        at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:479)
        at org.jruby.ext.socket.RubySocket.connect(RubySocket.java:388)
        at org.jruby.ext.socket.RubySocket.connect_nonblock(RubySocket.java:353)
        at 
org.jruby.ext.socket.RubySocket$i$1$0$connect_nonblock.call(RubySocket$i$1$0$connect_nonblock.gen:65535)
        at 
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:137)
        at 
rubyjit.open_9FF8DD58E409A6A12D778FF27EEFA8B7D8A04FF8.chained_2_rescue_2$RUBY$SYNTHETIC__file__(/Users/mperham/src/git/dalli/lib/dalli/socket.rb:66)
        at 
rubyjit.open_9FF8DD58E409A6A12D778FF27EEFA8B7D8A04FF8.chained_1_rescue_line_62(/Users/mperham/src/git/dalli/lib/dalli/socket.rb:65)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to