Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange connection bug #49

Closed
Jaykah opened this issue Feb 13, 2014 · 9 comments
Closed

Strange connection bug #49

Jaykah opened this issue Feb 13, 2014 · 9 comments

Comments

@Jaykah
Copy link

Jaykah commented Feb 13, 2014

I am having issues connecting to my Openfire via Candy Chat + Punjab.

-The http-bind url is fine (returns XEP-0124 - BOSH )
-When proxypass is set to Openfire's http-bind (7070), chat logs in fine (so Openfire is not an issue).

That's what I see in the browser:

Response Headers
Access-Control-Allow-Head... Content-Type
Access-Control-Allow-Orig... *
Connection Keep-Alive
Content-Encoding gzip
Content-Length 107
Content-Type text/xml
Date Thu, 13 Feb 2014 04:36:42 GMT
Keep-Alive timeout=5, max=120
Server TwistedWeb/13.0.0
Vary Accept-Encoding
Request Headers
Accept text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Content-Length 207
Content-Type text/plain; charset=UTF-8
Cookie SESSID=il9pqufgugh99p90jkat9ckkk3
Host callision.info
Referer https://website.info/public/gui/candy-chat/example/
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0

Post is:

<body rid='2642190037' xmlns='http://jabber.org/protocol/httpbind' to='website' xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/>

Response:

<body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>

Here's the log:

==================================
2014-02-12 23:31:48-0500 [HTTPChannel,4,162.242.220.52] Starting factory <punjab.session.Session object at 0x2344210>
2014-02-12 23:31:48-0500 [HTTPChannel,4,162.242.220.52] DNSDatagramProtocol starting on 4303
2014-02-12 23:31:48-0500 [HTTPChannel,4,162.242.220.52] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344910>
2014-02-12 23:31:48-0500 [-] (UDP Port 4303 Closed)
2014-02-12 23:31:48-0500 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344910>
2014-02-12 23:31:48-0500 [-] <punjab.session.XMPPClientConnector instance at 0x2348ef0> will retry in 3 seconds
2014-02-12 23:31:48-0500 [-] Stopping factory <punjab.session.Session object at 0x2344210>
2014-02-12 23:31:51-0500 [-] Starting factory <punjab.session.Session object at 0x2344210>
2014-02-12 23:31:51-0500 [-] DNSDatagramProtocol starting on 27535
2014-02-12 23:31:51-0500 [-] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x23449d0>
2014-02-12 23:31:51-0500 [-] (UDP Port 27535 Closed)
2014-02-12 23:31:51-0500 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x23449d0>
2014-02-12 23:31:51-0500 [-] <punjab.session.XMPPClientConnector instance at 0x2348ef0> will retry in 9 seconds
2014-02-12 23:31:51-0500 [-] Stopping factory <punjab.session.Session object at 0x2344210>
2014-02-12 23:32:01-0500 [-] Starting factory <punjab.session.Session object at 0x2344210>
2014-02-12 23:32:01-0500 [-] DNSDatagramProtocol starting on 32671
2014-02-12 23:32:01-0500 [-] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344590>
2014-02-12 23:32:01-0500 [-] (UDP Port 32671 Closed)
2014-02-12 23:32:01-0500 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344590>
2014-02-12 23:32:01-0500 [-] Abandoning <punjab.session.XMPPClientConnector instance at 0x2348ef0> after 3 retries.
2014-02-12 23:32:01-0500 [-] Stopping factory <punjab.session.Session object at 0x2344210>
2014-02-12 23:32:16-0500 [-] ================================== 955218fa57d30bb0c3287d44d4aa92522178edfd 1392265936.14 startup timeout ==================================
2014-02-12 23:32:16-0500 [-] HTTPB Error 200
2014-02-12 23:32:16-0500 [-] HTTPB Return Error: 200 -> <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
2014-02-12 23:32:16-0500 [-] 162.242.220.52 - - [13/Feb/2014:04:32:15 +0000] "POST /http-bind HTTP/1.1" 200 105 "https://website.info/public/gui/candy-chat/example/" "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0"
2014-02-12 23:33:48-0500 [-] SESSION -> Terminate
2014-02-12 23:33:48-0500 [-] expire (955218fa57d30bb0c3287d44d4aa92522178edfd)
2014-02-12 23:33:48-0500 [-] 0
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] HEADERS 1392266202.22:
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] <twisted.web.http_headers._DictHeaders object at 0x228f690>
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] HTTPB POST : 
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] <body rid='3499346755' xmlns='http://jabber.org/protocol/httpbind' to='website' xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/>
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] Session Created : aae4cf27919de6c4ccbdb52df50925fda1fd79b9 1392266202.22
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] ================================== 1392266202.22 connect to website:5222 ==================================
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] Starting factory <punjab.session.Session object at 0x2344710>
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] DNSDatagramProtocol starting on 6857
2014-02-12 23:36:42-0500 [HTTPChannel,4,162.242.220.52] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344a90>
2014-02-12 23:36:42-0500 [-] (UDP Port 6857 Closed)
2014-02-12 23:36:42-0500 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344a90>
2014-02-12 23:36:42-0500 [-] <punjab.session.XMPPClientConnector instance at 0x2349ea8> will retry in 3 seconds
2014-02-12 23:36:42-0500 [-] Stopping factory <punjab.session.Session object at 0x2344710>
2014-02-12 23:36:45-0500 [-] Starting factory <punjab.session.Session object at 0x2344710>
2014-02-12 23:36:45-0500 [-] DNSDatagramProtocol starting on 19014
2014-02-12 23:36:45-0500 [-] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344790>
2014-02-12 23:36:45-0500 [-] (UDP Port 19014 Closed)
2014-02-12 23:36:45-0500 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344790>
2014-02-12 23:36:45-0500 [-] <punjab.session.XMPPClientConnector instance at 0x2349ea8> will retry in 9 seconds
2014-02-12 23:36:45-0500 [-] Stopping factory <punjab.session.Session object at 0x2344710>
2014-02-12 23:36:54-0500 [-] Starting factory <punjab.session.Session object at 0x2344710>
2014-02-12 23:36:54-0500 [-] DNSDatagramProtocol starting on 19668
2014-02-12 23:36:54-0500 [-] Starting protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344310>
2014-02-12 23:36:54-0500 [-] (UDP Port 19668 Closed)
2014-02-12 23:36:54-0500 [-] Stopping protocol <twisted.names.dns.DNSDatagramProtocol object at 0x2344310>
2014-02-12 23:36:54-0500 [-] Abandoning <punjab.session.XMPPClientConnector instance at 0x2349ea8> after 3 retries.
2014-02-12 23:36:54-0500 [-] Stopping factory <punjab.session.Session object at 0x2344710>
2014-02-12 23:37:10-0500 [-] ================================== aae4cf27919de6c4ccbdb52df50925fda1fd79b9 1392266230.14 startup timeout ==================================
2014-02-12 23:37:10-0500 [-] HTTPB Error 200
2014-02-12 23:37:10-0500 [-] HTTPB Return Error: 200 -> <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
2014-02-12 23:37:10-0500 [-] 162.242.220.52 - - [13/Feb/2014:04:37:09 +0000] "POST /http-bind HTTP/1.1" 200 105 "https://website.info/public/gui/candy-chat/example/" "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0"
2014-02-12 23:38:42-0500 [-] SESSION -> Terminate
2014-02-12 23:38:42-0500 [-] expire (aae4cf27919de6c4ccbdb52df50925fda1fd79b9)
2014-02-12 23:38:42-0500 [-] 0

Please advise.

Thanks!

@twonds
Copy link
Owner

twonds commented Feb 13, 2014

Is your hostname 'website' ? It looks like its a DNS lookup issue for you xmpp hostname you are trying to connect to.

@Jaykah
Copy link
Author

Jaykah commented Feb 13, 2014

I edited the log, replacing the url of my website with "website.info", and the domain without extension to "website" so that shouldn't be the issue.

@twonds
Copy link
Owner

twonds commented Feb 13, 2014

Yeah but it looks like DNS lookups are failing. It is either not connecting or after the lookup it has an error. Can you do an srv lookup from the server running punjab?

@Jaykah
Copy link
Author

Jaykah commented Feb 13, 2014

I have two servers:

  1. website.info - it is running the application/candy chat client
  2. chat.website.com - it is running openfire/punjab

root@openfire-production:~# dig chat.website.com

; <<>> DiG 9.9.3-rpz2+rl.13214.22-P2-Ubuntu-1:9.9.3.dfsg.P2-4ubuntu1.1 <<>> chat.website.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64643
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;chat.website.com. IN A

;; ANSWER SECTION:
chat.website.com. 3600 IN A 162.222.126.8*

;; Query time: 5 msec
;; SERVER: 69.222.0.164_#53(69.222.0.164)_
;; WHEN: Thu Feb 13 14:29:49 EST 2014
;; MSG SIZE rcvd: 63

(*I changed the ips)

@twonds
Copy link
Owner

twonds commented Feb 14, 2014

Punjab will do a SRV lookup for the host you are trying to connect to, in most cases, its is the domain part of the jid. Unfortunately, this part is a bit difficult to debug in Punjab. It is something I want to fix. However, there are a few things you can do to debug this, try and make a simple script to debug just the SRV lookup part, force a direct connection in Punjab's session.make_session code, or put route attributes in your session initialization xml, which will bypass the SRV lookup.

If you can determine that DNS is not the issue then we can go from there.

@Jaykah
Copy link
Author

Jaykah commented Feb 17, 2014

I have added bosh.connect_srv = False right after bosh = HttpbService(1) in punjab.tac.

Now, it does not do the SRV lookup, but there is still a connection issue.

Here's the log:

2014-02-17 17:27:04-0500 [-] twistd 13.0.0 (/usr/bin/python 2.7.5) starting up.
2014-02-17 17:27:04-0500 [-] reactor class: twisted.internet.epollreactor.EPollReactor.
2014-02-17 17:27:04-0500 [-] Site starting on 5280
2014-02-17 17:27:04-0500 [-] Starting factory <twisted.web.server.Site instance at 0x16721b8>
2014-02-17 17:27:07-0500 [HTTPChannel,0,162.222.222.22] HEADERS 1392676027.35:
2014-02-17 17:27:07-0500 [HTTPChannel,0,162.222.222.22] <twisted.web.http_headers._DictHeaders object at 0x1816dd0>
2014-02-17 17:27:07-0500 [HTTPChannel,0,162.222.222.22] HTTPB POST :
2014-02-17 17:27:07-0500 [HTTPChannel,0,162.222.222.22]
2014-02-17 17:27:07-0500 [HTTPChannel,0,162.222.222.22] HTTPB Error 400
2014-02-17 17:27:07-0500 [HTTPChannel,0,162.222.222.22] 162.222.222.22 - - [17/Feb/2014:22:27:06 +0000] "POST /http-bind/ HTTP/1.1" 400 - "https://ddododo33.website.info/" "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36"
2014-02-17 17:27:23-0500 [HTTPChannel,0,162.222.222.22] HEADERS 1392676043.06:
2014-02-17 17:27:23-0500 [HTTPChannel,0,162.222.222.22] <twisted.web.http_headers._DictHeaders object at 0x1816e50>
2014-02-17 17:27:23-0500 [HTTPChannel,0,162.222.222.22] HTTPB POST :
2014-02-17 17:27:23-0500 [HTTPChannel,0,162.222.222.22]
2014-02-17 17:27:23-0500 [HTTPChannel,0,162.222.222.22] Session Created : 452323b4eff66f88364f7f670536df756a6f222d 1392676043.06
2014-02-17 17:27:23-0500 [HTTPChannel,0,162.222.222.22] ================================== 1392676043.06 connect to website:5222 ==================================
2014-02-17 17:27:23-0500 [HTTPChannel,0,162.222.222.22] Starting factory <punjab.session.Session object at 0x181a950>
2014-02-17 17:27:23-0500 [-] <twisted.internet.tcp.Connector instance at 0x18bc518> will retry in 2 seconds
2014-02-17 17:27:23-0500 [-] Stopping factory <punjab.session.Session object at 0x181a950>
2014-02-17 17:27:25-0500 [-] Starting factory <punjab.session.Session object at 0x181a950>
2014-02-17 17:27:25-0500 [-] <twisted.internet.tcp.Connector instance at 0x18bc518> will retry in 5 seconds
2014-02-17 17:27:25-0500 [-] Stopping factory <punjab.session.Session object at 0x181a950>
2014-02-17 17:27:30-0500 [-] Starting factory <punjab.session.Session object at 0x181a950>
2014-02-17 17:27:30-0500 [-] Abandoning <twisted.internet.tcp.Connector instance at 0x18bc518> after 3 retries.
2014-02-17 17:27:30-0500 [-] Stopping factory <punjab.session.Session object at 0x181a950>
2014-02-17 17:27:41-0500 [HTTPChannel,1,162.222.222.22] HEADERS 1392676061.29:
2014-02-17 17:27:41-0500 [HTTPChannel,1,162.222.222.22] <twisted.web.http_headers._DictHeaders object at 0x18c2090>
2014-02-17 17:27:41-0500 [HTTPChannel,1,162.222.222.22] HTTPB POST :
2014-02-17 17:27:41-0500 [HTTPChannel,1,162.222.222.22]
2014-02-17 17:27:41-0500 [HTTPChannel,1,162.222.222.22] Session Created : 5284b55f3fc5f8a0bba4f1cea0572086e4642c6d 1392676061.29
2014-02-17 17:27:41-0500 [HTTPChannel,1,162.222.222.22] ================================== 1392676061.29 connect to website:5222 ==================================
2014-02-17 17:27:41-0500 [HTTPChannel,1,162.222.222.22] Starting factory <punjab.session.Session object at 0x18c24d0>
2014-02-17 17:27:41-0500 [-] <twisted.internet.tcp.Connector instance at 0x18c6170> will retry in 2 seconds
2014-02-17 17:27:41-0500 [-] Stopping factory <punjab.session.Session object at 0x18c24d0>
2014-02-17 17:27:43-0500 [-] Starting factory <punjab.session.Session object at 0x18c24d0>
2014-02-17 17:27:43-0500 [-] <twisted.internet.tcp.Connector instance at 0x18c6170> will retry in 7 seconds
2014-02-17 17:27:43-0500 [-] Stopping factory <punjab.session.Session object at 0x18c24d0>

@twonds
Copy link
Owner

twonds commented Feb 18, 2014

That looks like it can not make the connection to port 5222 of the xmpp server.

@Jaykah
Copy link
Author

Jaykah commented Feb 19, 2014

netstat shows:

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 162.222.222.22:5222 :::* LISTEN 12332/java

-punjab is on the same server as openfire
-Ufw is disabled just in case.

Can it be related to the prior srv issue?

@Jaykah
Copy link
Author

Jaykah commented Feb 27, 2014

The issue has been solved by adding the chat domain/ip pair to /etc/hosts.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants