fritzy / SleekXMPP

Python 2.6+/3.1+ XMPP Library
http://groups.google.com/group/sleekxmpp-discussion
Other
1.1k stars 299 forks source link

Freeze at connection to some hosts. #126

Closed bguina closed 12 years ago

bguina commented 12 years ago

ClientXMPP does not return when trying to connect using some domain names.

from sleekxmpp import ClientXMPP c = ClientXMPP('jabber.org', '') c.connect(reattempt=False) True c = ClientXMPP('www.google.com', '') c.connect(reattempt=False)

c = ClientXMPP('google.com', '') c.connect(reattempt=False) True c = ClientXMPP('google.org', '') c.connect(reattempt=False) c = ClientXMPP('goodsfgsdfggle.org', '') c.connect(reattempt=False) False

It is not obvious to me why and which domain would return or not. My current sleekxmpp version is 1.0rc3. This happens no matter the version of python I'm using (2.6.6 and 2.7.0 at least) and whether or not I installed dnspython.

update : It seems to happen only with domain names having A records but no SRV records.

legastero commented 12 years ago

The freeze is not a deadlock issue, but rather a delay waiting for the socket.connect() call to timeout. This is expected to happen if a connection attempt is made to a host+port that will not respond. That some domains failed to connect immediately is a result of not finding any host IP to connect to at all.

However, the timeout for socket connection is fairly long; I had to leave things running for a few minutes before a socket error was thrown and a connection reattempt was made.