Re: connection.attach and 404 from OpenFire: Logs included!

1,074 views
Skip to first unread message

nkeeney

unread,
Jul 11, 2012, 12:06:23 PM7/11/12
to str...@googlegroups.com
Sorry to bump, but I saw Jack M. made a round of the forums and skipped my question. Any chance I can get an answer for this? We are on the brink of dropping Strophe altogether for this project.

Thanks!
-Nathan

On Thursday, June 28, 2012 11:50:43 AM UTC-7, nkeeney wrote:
I apologize for posting yet another attach / openfire question, but I did read all of the other ones on the group, and I'll do my best to provide the necessary logs. I have confirmed that RID incrementing is not the issue!

If I manually (using Firebug + Firefox 13.0.1) pause(); the connection, wait until the current outstanding poll returns (< 30 secs), and then refresh the page - then attach works. RID is correctly sequential, incoming chats arrived, beautiful.

However, if I refresh the page (my window onunload handler pauses() the connection, but the browser necessarily kills the open http connection), the attach always fails with a "404 Invalid SID". The OpenFire logs are less than helpful:
org.jivesoftware.openfire.http.HttpBindServlet - Client provided invalid session: 2906e09b. [4.30.25.205]

I am *not* using Punjab (I have an Apache reverse proxy to talk to my OpenFire server). Is there any way to gracefully detach Strophe on page unload? Is there any way to configure OpenFire to not kill my SID when http connection is aborted? What are other people doing in this situation?

Thanks! Logs follow: (Note that I'm using the aborted RID as the first request RID after refresh - I have tried using the sequential next RID instead, but it also gives a 404 error). Firebug shows "NetworkError: 404 Invalid SID. - https://tt-acd03.onstate.net/ChatProxyBOSH/http-bind/"

Before Refresh:
Strophe is connecting.
SEND: <body rid='3570631089' xmlns='http://jabber.org/protocol/httpbind' to='onstate.net' 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'/>
RECV: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams' authid='eb543d59' sid='eb543d59' secure='true' requests='2' inactivity='30' polling='5' wait='60' hold='1' ack='3570631089' maxpause='300' ver='1.6'><stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></mechanisms><compression xmlns='http://jabber.org/features/compress'><method>zlib</method></compression><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features></body>
SEND: <body rid='3570631090' xmlns='http://jabber.org/protocol/httpbind' sid='eb543d59'><auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>Y2V1c2VyQG9uc3RhdGUubmV0AGNldXNlcgBDZXVzZXIwIQ==</auth></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/></body>
SEND: <body rid='3570631091' xmlns='http://jabber.org/protocol/httpbind' sid='eb543d59' to='onstate.net' xml:lang='en' xmpp:restart='true' xmlns:xmpp='urn:xmpp:xbosh'/>
RECV: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'><stream:features><compression xmlns='http://jabber.org/features/compress'><method>zlib</method></compression><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features></body>
SEND: <body rid='3570631092' xmlns='http://jabber.org/protocol/httpbind' sid='eb543d59'><iq type='set' id='_bind_auth_2' xmlns='jabber:client'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' id='_bind_auth_2' to='onstate.net/eb543d59'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>ceuser@onstate.net/eb543d59</jid></bind></iq></body>
SEND: <body rid='3570631093' xmlns='http://jabber.org/protocol/httpbind' sid='eb543d59'><iq type='set' id='_session_auth_2' xmlns='jabber:client'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' id='_session_auth_2' to='ceu...@onstate.net/eb543d59'/></body>
Strophe is connected. JID: ceu...@onstate.net/eb543d59 SID: eb543d59 RID: 3570631094
SEND: <body rid='3570631094' xmlns='http://jabber.org/protocol/httpbind' sid='eb543d59'><presence xmlns='jabber:client'/></body>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><presence xmlns='jabber:client' from='ceu...@onstate.net/18d541d5' to='ceu...@onstate.net/eb543d59'/></body>
SEND: <body rid='3570631095' xmlns='http://jabber.org/protocol/httpbind' sid='eb543d59'/>
RECV: <body xmlns='http://jabber.org/protocol/httpbind'><presence xmlns='jabber:client' from='ceu...@onstate.net/8059bba' to='ceu...@onstate.net/eb543d59'/><presence xmlns='jabber:client' from='ceu...@onstate.net/d0717c90' to='ceu...@onstate.net/eb543d59'/><presence xmlns='jabber:client' from='ceu...@onstate.net/2cd34fe0' to='ceu...@onstate.net/eb543d59'/></body>
SEND: <body rid='3570631096' xmlns='http://jabber.org/protocol/httpbind' sid='eb543d59'/>

After refresh:
Attempting Strophe connection with saved jid: ceu...@onstate.net/eb543d59 sid: eb543d59 rid: 3570631096
Strophe is attaching...
Strophe is attached.
SEND: <body rid='3570631096' xmlns='http://jabber.org/protocol/httpbind' sid='eb543d59'/>
RECV: <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='item-not-found'/>
Strophe failed to connect.
Strophe is disconnecting.
LOG: Disconnect was called because: undefined
LOG: _sendTerminate was called
LOG: _throttledRequestHandler called with 1 requests
LOG: request id 2.0 posting
LOG: request id 2.0 state changed to 1
LOG: request id 2.0 state changed to 1
SEND: <body rid='3570631097' xmlns='http://jabber.org/protocol/httpbind' sid='eb543d59' type='terminate'><presence xmlns='jabber:client' type='unavailable'/></body>
LOG: request id 2.1 state changed to 2
LOG: request id 2.1 state changed to 3
LOG: request id 2.1 state changed to 3
LOG: request id 2.1 state changed to 4
LOG: request errored, status: 404, number of errors: 1
LOG: _onDisconnectTimeout was called
LOG: _doDisconnect was called
Strophe is disconnected. Re-connecting.

If I use the next sequential RID instead (outstanding poll at refresh time was 2914479752):
Attempting Strophe connection with saved jid: ceu...@onstate.net/246f5dd7 sid: 246f5dd7 rid: 2914479753
Strophe is attaching...
Strophe is attached.
SEND: <body rid='2914479753' xmlns='http://jabber.org/protocol/httpbind' sid='246f5dd7'/>
LOG: request id 1.1 error 404 happened
LOG: request errored, status: 404, number of errors: 1
Strophe is disconnecting.
LOG: _doDisconnect was called
Strophe is disconnected. Re-connecting.

Jack Moffitt

unread,
Jul 11, 2012, 12:12:04 PM7/11/12
to str...@googlegroups.com
> Sorry to bump, but I saw Jack M. made a round of the forums and skipped my
> question. Any chance I can get an answer for this? We are on the brink of
> dropping Strophe altogether for this project.

Sorry that I missed it. It appears your question is just like the
dozens of other Openfire questions. You detach, you do everything you
are supposed to do with the RID, and Openfire disconnects you.

I responded to a previous person pretty in depth on why I think this
happens (my theory was that they are not caching the current RID until
after they've generated a response).

I have no idea why this happens, but I'm pretty sure if you use
another XMPP server (or use Punjab in front of Openfire) it will work
fine. I know several people have tried to contact the Openfire guys to
find out what's going on, but I haven't heard anything resulting from
that.

jack.

nkeeney

unread,
Jul 11, 2012, 12:22:58 PM7/11/12
to str...@googlegroups.com
Thanks Jack, I'll try Punjab.

You might want to put a big bold notice on the Strophe main page so that newbies like myself get a head's up about this attachment issue. It seems pretty widespread.

Thanks!
-Nathan

Jack Moffitt

unread,
Jul 11, 2012, 12:38:45 PM7/11/12
to str...@googlegroups.com
> You might want to put a big bold notice on the Strophe main page so that
> newbies like myself get a head's up about this attachment issue. It seems
> pretty widespread.

It's widespread in that everyone seems to jump onto Openfire as their
first XMPP server. I have no idea why this is.

Is there some reason everyone chooses Openfire over Prosody or
ejabberd or the other options?

Would adding a note to the API docs be helpful instead? I'd like to
put it where people who are attempting to use session attachment are
most likely to see it. Better yet would be to get this fixed in
Openfire so that no one would have any problems at all!

jack.

nkeeney

unread,
Jul 11, 2012, 12:45:53 PM7/11/12
to str...@googlegroups.com
For me, it wasn't a choice: The team responsible for implementing our chat proxies and gateways chose OpenFire for various reasons. We use it for a lot more than just BOSH. I'm the web applications developer, so when choosing libraries to implement a web-based chat interface for our OpenFire solution, I chose Strophe. It would have been useful while reading about Strophe to know that it requires a connection manager to interface correctly with OpenFire in some situations (regardless of whose fault the bug is). Would have saved me about a week had I begun with Punjab.

-Nathan

Michael Weibel

unread,
Jul 11, 2012, 1:43:01 PM7/11/12
to str...@googlegroups.com

> Is there some reason everyone chooses Openfire over Prosody or
> ejabberd or the other options?

Well, we also took openfire as the first xmpp server. Particularly for the following reasons:

- _very_ easy installation.. A web based setup process is just great
- Webadmin interface is great as well
- Java (more known than erlang/lua)
- Very easy to configure a different data source (database, table and SQL statement) for authentication

These 4 things are very attractive to newbies I think :)

But once you encounter issues, it seems that openfire needs to be replaced everywhere, sadly :(

Steffen Larsen

unread,
Jul 12, 2012, 4:58:40 AM7/12/12
to str...@googlegroups.com
Hi,

If you still want a java implementation of an XMPP server, I would highly recommend you to take a look at Tigase (www.tigase.org).
Its rock solid and a very flexible server where you can do your own auth, userdb and a lot of plugins and ad-hoc commands very easy!
There is no webadmin, but a very simple property file which is documented on their site. The installation is to run a jar.

Openfire is good for simple testing when starting to learn the XMPP protocol and how the server works - afterwards most want something else.. because of speed, flexibility and the communities. :-)
Openfire is very closed in its way of communicating and fixing bugs - probably because they have their own product - JIVE...

So if you want production ready systems choose either ejabberd, tigase or prosody.. depending on which module you need to have and if you need clustering etc.

See the full list of servers here: http://xmpp.org/xmpp-software/servers/


-Just my 50 cent! Cheers!

/Steffen
> --
> You received this message because you are subscribed to the Google Groups "Strophe" group.
> To post to this group, send email to str...@googlegroups.com.
> To unsubscribe from this group, send email to strophe+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/strophe?hl=en.
>

Charlie Garrison

unread,
Jul 11, 2012, 10:34:35 PM7/11/12
to str...@googlegroups.com
Good afternoon,

On 11/07/12 at 10:38 AM -0600, Jack Moffitt <ja...@metajack.im> wrote:

>Is there some reason everyone chooses Openfire over Prosody or
>ejabberd or the other options?

We chose Openfire for the external database integration. Can't
recall whether we looked at Prosody; ejabberd was either too
difficult to get external database or we had to have to
duplicate list of users (can't recall which).


Charlie

--
Ꮚ Charlie Garrison ♊ <garr...@zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

Vineet Naik

unread,
Jul 13, 2012, 10:45:16 AM7/13/12
to str...@googlegroups.com
Hi,
 
We chose Openfire for the external database integration. Can't recall whether we looked at Prosody; ejabberd was either too difficult to get external database or we had to have to duplicate list of users (can't recall which).


We had initially chosen Openfire for the exact same reasons. But later we moved over to ejabberd as 
we found it was actually quite easy to configure even with no significant Erlang knowledge, mainly because the community
is very helpful and also because the main config file is filled with useful comments for each setting.

If you are looking to configure ejabberd with mysql as an external database here is a step by step guide - 

PS: Your "Duplicate users" point is valid but we could live with it
 

Charlie

--
   Ꮚ Charlie Garrison ♊ <garr...@zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt
--
You received this message because you are subscribed to the Google Groups "Strophe" group.
To post to this group, send email to str...@googlegroups.com.
To unsubscribe from this group, send email to strophe+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/strophe?hl=en.




--
Vineet Naik


Charlie Garrison

unread,
Jul 15, 2012, 9:42:01 PM7/15/12
to str...@googlegroups.com
Good morning,

On 13/07/12 at 8:15 PM +0530, Vineet Naik <nai...@gmail.com> wrote:

>If you are looking to configure ejabberd with mysql as an external database
>here is a step by step guide -
>https://support.process-one.net/doc/display/MESSENGER/Using+ejabberd+with+MySQL+native+driver

Thanks for that link, but:

Forbidden

You don't have permission to access
/doc/display/MESSENGER/Using+ejabberd+with+MySQL+native+driver
on this server.

>PS: Your "Duplicate users" point is valid but we could live with it

We *can* live with duplicate users, but decided not since we had
alternatives. I've done projects with 'duplicated' users before,
and it wasn't *if* they got out of sync; it was a matter of
*when*. Really wanted to avoid that this time.

Vineet Naik

unread,
Jul 15, 2012, 11:47:16 PM7/15/12
to str...@googlegroups.com
On Mon, Jul 16, 2012 at 7:12 AM, Charlie Garrison <garr...@zeta.org.au> wrote:
Thanks for that link, but:

    Forbidden

    You don't have permission to access /doc/display/MESSENGER/Using+ejabberd+with+MySQL+native+driver on this server.



PS: Your "Duplicate users" point is valid but we could live with it

We *can* live with duplicate users, but decided not since we had alternatives. I've done projects with 'duplicated' users before, and it wasn't *if* they got out of sync; it was a matter of *when*. Really wanted to avoid that this time.



Charlie

--
   Ꮚ Charlie Garrison ♊ <garr...@zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt

--
You received this message because you are subscribed to the Google Groups "Strophe" group.
To post to this group, send email to str...@googlegroups.com.
To unsubscribe from this group, send email to strophe+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/strophe?hl=en.




--
Vineet Naik


Charlie Garrison

unread,
Jul 16, 2012, 12:10:06 AM7/16/12
to str...@googlegroups.com
Good afternoon,

On 16/07/12 at 9:17 AM +0530, Vineet Naik <nai...@gmail.com> wrote:

>Don't know what happened there..
>
>Here is the cached version on google -
>http://webcache.googleusercontent.com/search?q=cache:wBFBcy6V3CUJ:https://support.process-one.net/
>doc/display/MESSENGER/Using%2Bejabberd%2Bwith%2BMySQL%2Bnative%2Bdriver&hl=en&gl=in&prmd=imvns&strip
>=1
>

Thanks for that link. From what I can see that is only for
having ejabberd database in mysql, but not using an existing
schema for user auth. Can I use our own users table for auth
with ejabberd?

Thanks,

Michael Weibel

unread,
Jul 16, 2012, 12:26:28 AM7/16/12
to str...@googlegroups.com

I don't think so but you can provide an external auth script (which won't scale) or you can write a module in erlang which authenticates the users with your existing users table.

Charlie Garrison

unread,
Jul 16, 2012, 4:12:03 AM7/16/12
to str...@googlegroups.com
Good evening,

On 16/07/12 at 6:26 AM +0200, Michael Weibel
<michael...@gmail.com> wrote:

>I don't think so but you can provide an external auth script (which won't
>scale) or you can write a module in erlang which authenticates the users
>with your existing users table.

Hmm, a custom module sounds practical. Since I know zero erlang,
how hard would it be to code a custom authentication module? Are
there some examples to use as starting points? I've had a look
through ejabberd site but couldn't see examples except for
external auth.

When I first started with Strophe I wanted to go with ejabberd
for the server, but the separate users table made us look at
other servers. I'd be quite happy to go back to ejabberd if we
can write a custom module for auth against our existing mysql schema.

Michael Weibel

unread,
Jul 17, 2012, 3:38:19 AM7/17/12
to str...@googlegroups.com
Hi Charlie,
>
> Hmm, a custom module sounds practical. Since I know zero erlang, how hard would it be to code a custom authentication module? Are there some examples to use as starting points? I've had a look through ejabberd site but couldn't see examples except for external auth.

Well zero expierence with erlang is not very helpful for developing a custom auth module ;) As a starting point I'd recommend to take a look at https://github.com/processone/ejabberd/blob/2.1.x/src/ejabberd_auth_odbc.erl

Which implements the odbc authentication. Of course you'd need to setup an own connection to your own database and then execute custom SQL statements on top of it.

Maybe you could ask ProcessOne to develop a module where you could define the DB server to connect to, the SQL statements to execute for the various methods you'd need to implement.. (Something like openfire already has with it's custom db auth configuration options).

- Michael

Steffen Larsen

unread,
Jul 17, 2012, 3:44:23 AM7/17/12
to str...@googlegroups.com
Yes I would say the same. Choose the XMPP server carefully and choose it in a context of a language that you know, so you easily can expand it.
If you know erlang, go for it.. Its a cool language and a nice scalable server. If you instead know java go for Tigase.. It is very extendable as well. To do a authmodule is just to implement a class.. If you just need to do an external authentication, then you just alter your config and point to a new jdbc url and alter the SQL in the config as well to fetch and auth. your users from your external database.

--Cheers!
/Steffen
> --
> You received this message because you are subscribed to the Google Groups "Strophe" group.
> To post to this group, send email to str...@googlegroups.com.
> To unsubscribe from this group, send email to strophe+u...@googlegroups.com.

Chongde Lin

unread,
Nov 5, 2012, 2:43:47 AM11/5/12
to str...@googlegroups.com
Jack, i am using Punjab in front of Openfire.It is working fine in Chrome and FF when page load with attach.
But IE will happen RID SKIPPING cause DISCONNECT after page reload, come with following debug:

Unspecified error:
XDomainRequest.prototype.oldsend.apply(this, arguments);

In order to make cross chat work with xdomainrequest, I use https://gist.github.com/767777 js libary with a little modify.



在 2012年7月12日星期四UTC+8上午12时22分58秒,nkeeney写道:

Jack Moffitt

unread,
Nov 5, 2012, 8:23:46 AM11/5/12
to strophe
> But IE will happen RID SKIPPING cause DISCONNECT after page reload, come
> with following debug:
>
> Unspecified error:
> XDomainRequest.prototype.oldsend.apply(this, arguments);

Sounds like it's a bug in that plugin perhaps. You can eliminate that
by setting up a reverse proxy so that your javascript and your BOSH
endpoint are on the same host/port pair. Then you can remove the
plugin and retest in IE and see if it is still a problem. This would
at least point you to where the problem is, IE or the XDomain plugin.

jack.

Daniel Dormont

unread,
Nov 5, 2012, 6:24:45 PM11/5/12
to str...@googlegroups.com
On Mon, Nov 5, 2012 at 2:43 AM, Chongde Lin <linchon...@gmail.com> wrote:
> Jack, i am using Punjab in front of Openfire.It is working fine in Chrome
> and FF when page load with attach.
> But IE will happen RID SKIPPING cause DISCONNECT after page reload, come
> with following debug:
>
> Unspecified error:
> XDomainRequest.prototype.oldsend.apply(this, arguments);
>
> In order to make cross chat work with xdomainrequest, I use
> https://gist.github.com/767777 js libary with a little modify.
>
>

I've gotten that error too, but only on certain machines and only in
certain conditions. I'm completely stumped as to the cause. Anyone who
has experience using Strophe with CORS in MSIE, do you use the same
plugin Chongde linked to above? Or any variant on it? Have you seen
any errors along these lines?

dan
> --
> You received this message because you are subscribed to the Google Groups
> "Strophe" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/strophe/-/9ujyvRFmdrcJ.
Reply all
Reply to author
Forward
0 new messages