lnussbaum / xmpp4r

XMPP/Jabber Library for Ruby - please use:
http://github.com/xmpp4r/xmpp4r
Other
312 stars 1 forks source link

jruby openssl hangs. #15

Open yannBytemark opened 14 years ago

yannBytemark commented 14 years ago

Under ruby-1.8.7, the following code works fine.

require 'rubygems' 
require 'xmpp4r'
require 'xmpp4r/xhtml'
require 'xmpp4r/roster'
require 'xmpp4r/muc/helper/simplemucclient'
require 'timeout'
require 'pp'
include Jabber
Jabber::debug = true
@jid = "mauvealert@****/****"
@client = Client.new(JID::new(@jid))
@client.connect

Under jruby-1.5.1, the above code hangs at the @client.connect, the problem is the call to sslsocket.connect which hangs. Anyone can see why this is?

jruby-1.5.1 > @client.connect
D, [2010-10-28T15:03:46.754000 #30848] DEBUG -- : RESOLVING:
_xmpp-client._tcp.****.co.uk (SRV)
D, [2010-10-28T15:03:46.875000 #30848] DEBUG -- : CONNECTING:
****.co.uk:5222
D, [2010-10-28T15:03:46.930000 #30848] DEBUG -- : SENDING:
stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' to='****.co.uk' xml:lang='en' version='1.0'
D, [2010-10-28T15:03:47.006000 #30848] DEBUG -- : RECEIVED:

D, [2010-10-28T15:03:47.017000 #30848] DEBUG -- : RECEIVED:

D, [2010-10-28T15:03:47.019000 #30848] DEBUG -- : FEATURES: received
D, [2010-10-28T15:03:47.020000 #30848] DEBUG -- : PROCESSING:
 (REXML::Element)
D, [2010-10-28T15:03:47.021000 #30848] DEBUG -- : TRYING stanzacbs...
D, [2010-10-28T15:03:47.021000 #30848] DEBUG -- : TRYING message/iq/presence/cbs...
D, [2010-10-28T15:03:47.025000 #30848] DEBUG -- : FEATURES: waiting...
D, [2010-10-28T15:03:47.027000 #30848] DEBUG -- : FEATURES: waiting finished
D, [2010-10-28T15:03:47.030000 #30848] DEBUG -- : SENDING:

D, [2010-10-28T15:03:47.088000 #30848] DEBUG -- : RECEIVED:

D, [2010-10-28T15:03:47.106000 #30848] DEBUG -- : TLSv1:
cyx=#
D, [2010-10-28T15:03:47.120000 #30848] DEBUG -- : TLSv1:
@socket=#
D, [2010-10-28T15:03:47.122000 #30848] DEBUG -- : TLSv1: OpenSSL handshake in progress

Here are some extra data:

$ jruby -v
jruby 1.5.1 (ruby 1.8.7 patchlevel 249) (2010-06-06 f3a3480) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_22) [amd64-java]
$ gem list -d jruby-openssl
jruby-openssl (0.7.1)
$ gem list -d xmpp4r
xmpp4r (0.5)
$ uname -a
Linux desk4 2.6.31-22-generic #63-Ubuntu SMP Thu Aug 19 00:23:50 UTC 2010 x86_64 GNU/Linux

-- Note that this bug exists in Debian Squeeze as well.

xurde commented 11 years ago

I'm getting the same issue while running it in Rubinius 2.0-rc1 on Ubuntu.

Any advance?

xurde commented 11 years ago

Well. If you do a @jclient.allow_tls = false before connecting you will probably skip this random problem. It worked for me at least. :)

bladedoyle commented 10 years ago

Check that you have the correct openSSL libs installed. Check 32 v.s. 64bit. It looks like openfire (for example) runs as 32bit and if the openssl.i686 package is not installed these symptoms (hang in ssl handshake) will occur. Though, it does eventually time out.