twonds / punjab

BOSH connection manager
MIT License
183 stars 49 forks source link

Connection issues after upgrading strophejs to 1.1.3 from 1.1.1 #51

Closed may215 closed 8 years ago

may215 commented 10 years ago

Hi, I am running facebook chat chrome extension, and I am having several connection issues after upgrading strophe, (with version 1.1.1 everything is working fine) The server configuration: 1 X nginx+twisted+panjub

nginx is configured to proxy pass 80 to 5280, with /xmpp-httpbind (returns XEP-0124 - BOSH)

\ The reason I want to upgrade strophe is because I created bosh client(I want to save all the user credentials on the server for security reason) to set the session and pass it back to the client to attach. And I couldn't make the attach work with strophe version 1.1.1 . With version 1.1.3 I can make the attach work but, I have different errors that I get after 4-6 interactions with the server, errors 400, 404 (also after making the wait to 300 on both sides), I didn't try to debug it so match, but, the first thing I saw (on fiddler) is the the content-length is growing fast on each request, the first request length was 51~ and the third was 1980~, and after that it's got stacked like time out issue, and then I got the 404 / 400 error code, and strophe started the onDisconnect workflow.

But, my current problem when I am using the Strophe connect with all the credentials on the client is:

post:

<body rid='2642193213' 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'/>

\ I saw the issue: https://github.com/twonds/punjab/issues/49 And his solution is not working for me.

This is the error log I am getting:

2014-04-25 08:02:23+0000 [XmlStream,client] <body xmlns='http://jabber.org/protocol/httpbind'><failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/></failure></body>
2014-04-25 08:02:23+0000 [XmlStream,client] 4036512817
2014-04-25 08:02:23+0000 [XmlStream,client] 84.111.129.229 - - [25/Apr/2014:08:02:23 +0000] "POST /xmpp-httpbind HTTP/1.1" 200 134 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 U/1.6.3240.39 Safari/537.36"
2014-04-25 08:02:23+0000 [XmlStream,client] connect ERROR: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionDone'>: Connection was closed cleanly.
    ]
2014-04-25 08:02:23+0000 [XmlStream,client] Stopping factory <punjab.session.Session object at 0x7f8134912610>
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] HEADERS 1398412943.89:
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] <twisted.web.http_headers._DictHeaders object at 0x7f8134912ed0>
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] HTTPB POST : 
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] <body rid='4036512818' xmlns='http://jabber.org/protocol/httpbind' sid='869337c444e4f9e1729589b445b62268e3aca91e' type='terminate'/>
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] 4036512818
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] SESSION -> Terminate
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] expire (869337c444e4f9e1729589b445b62268e3aca91e)
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] 1
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] SID: 869337c444e4f9e1729589b445b62268e3aca91e => SEND: '</stream:stream>'
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] HTTPB Error 200
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] HTTPB Return Error: 200 -> <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='remote-connection-failed'/>
2014-04-25 08:02:23+0000 [HTTPChannel,40,84.111.129.229] 84.111.129.229 - - [25/Apr/2014:08:02:23 +0000] "POST /xmpp-httpbind HTTP/1.1" 200 105 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 U/1.6.3240.39 Safari/537.36"
2014-04-25 08:04:06+0000 [XmlStream,client] SID: 3166094157ff8f45a7ecb6d3f69a637c6d8a6f4b => RECV: '<'
2014-04-25 08:04:06+0000 [XmlStream,client] SID: 3166094157ff8f45a7ecb6d3f69a637c6d8a6f4b => RECV: "presence from='-1094827861@chat.facebook.com' to='-638088399@chat.facebook.com/2isc6xvg' type='unavailable'/>"
2014-04-25 08:04:06+0000 [XmlStream,client] 

The error 200 is strange.

The things I tried:

  1. set: bosh.connect_srv = False (punjab.tac)
  2. Re-install all the server from scratch.
  3. Upgrade twisted to the latest version.
  4. Connect to the server using the full http path with ip including port.
  5. Try to change the domain chat.facebook.com to their ip to avoid lookup issues.

Any help.. Thanks..

zhangam commented 10 years ago

Hi,i met the same problem as you.Did you solve the problem?If you do,please tell me how to fix it!My email address is zhangamins@163.com. Thank you!!

twonds commented 10 years ago

Sorry for the late response but is this still an issue? What happens if you force Punjab to only connect to that IP? Or print out the IP it is trying to connect to and make sure that is correct.

fpsColton commented 10 years ago

Have you tried adding the route attribute when calling connect() on Strophe?

I would try passing "xmpp:website:5222" into connect() as the value for route.

Note: This parameter was added in Strophe 1.1.3, ensure you're looking at the most recent documentation. http://strophe.im/strophejs/doc/1.1.3/files/strophe-js.html#Strophe.Connection.connect

Jaykah commented 10 years ago

This is an Openfire bug, please see https://igniterealtime.org/issues/browse/OF-636