powered by Jive Software

404 invalid sid

Hi all:

I build a xmpp web-based client and connect to openfire server. Every request from client to server has a requestId, the requestId shows an increase of 1. Openfire will remove the last request’s requestId(for example,requestId 1) when it receives a new request(for example, with requestId 2). In most cases,it works well.But sometimes,the client sent a bad request with requestId 3,and then,sent a request with requestId 4. Openfire received the request with requestId 4 and removed requestId 3.Soon, the client retried the request with requestId 3,openfire received it but could not find its requestId in cache.And then openfire tells the client ''you should terminate the connection". Finally the client terminated the connection What could i do to solve the problem…

2014.03.21 14:52:12 org.jivesoftware.openfire.http.HttpBindServlet - in rid:4069725244
2014.03.21 14:52:20 org.jivesoftware.openfire.http.HttpBindServlet - in rid:4069725243
2014.03.21 14:52:20 org.jivesoftware.openfire.http.HttpSession - Deliverable unavailable for 4069725243

I am sorry that my english is poor.

And thanks!!!

I noticed similar behavior, too in this thread:

According to XEP-124:

If the network connection is broken or closed before the client receives a response to a request from the connection manager, then the client MAY resend an exact copy of the original request. Whenever the connection manager receives a request with a ‘rid’ that it has already received, it SHOULD return an HTTP 200 (OK) response that includes the buffered copy of the original XML response to the client (i.e., a wrapper possessing appropriate attributes and optionally containing one or more XML payloads). If the original response is not available (e.g., it is no longer in the buffer), then the connection manager MUST return an ‘item-not-found’ terminal binding error

I believe it’s a bug in Openfire. At least it doesn’t implement the SHOULD clause.

What could i do to solve the problem

Probably not much, except looking at Openfire’s source code and try to find/fix it.

I was getting same error “404 invalid sid openfire” in browser console and response is as following -

I am using Storphe for BOSH connection.

While debugging I found that it goes in HttpSession class multiple time. Following condition in getResponse(HttpConnection connection) method creates issue -

if (connection.getRequestId() != lastRequestID + 1) {

  •            throw new HttpBindException("Unexpected RID error.",*
  •                    BoshBindingError.itemNotFound);*
  •        }*

This issue comes randomly and when it comes, value of connection.getRequestId() is 2 more than lastRequestID so this condition fails. I changed this condition as follow and i do not get this issue anymore -

** if ((connection.getRequestId()-lastRequestID) > 2) **

will there any other impact of this change or is there any alternate solution to this issue ?


Hard to tell. The “2” should maybe be the request attribute of the body? (it is usually 2).

Is this related to OF-229 ?

We had the same issue, we discovered that our strophe.js sample code wasn’t behaving well (see below), once we used Candy.js (which uses strophe.js) we never experienced the issue. However, since we have no interest in using Candy’s UI, we now have to figure out what our old demo client was doing wrong that Candy is doing right. But at least we have a working model to start with (turning on candy console debug logging helps).

I don’t know the details, but it seems the sample code I was using for strophe.js is the issue. It is not with Openfire and/or its BOSH (http-bind) implemenation. As when I use candy-1.7.1.js (which uses strophe.js as its xmpp lib) we are able to maintain length chat sessions without.

Thanks for listening.