BOSH connection in 4.7.1 fails with invalid rid error

We have the storphe openfire client which creates the http-bind request once in 30 seconds and everything works fine. After few hours of keeping the session idle, the response for the http-bind gives the old values of rid value not the one requested.

Request: <body rid='771796934' xmlns='' sid='zgnmepnk3'/>
Response: <body xmlns='' ack='771796934'>

Request: <body rid='771796935' xmlns='' sid='zgnmepnk3'/>
Response: <body xmlns='' ack='771796935'>

Request: <body rid='771796936' xmlns='' sid='zgnmepnk3'/>
Response: <body xmlns='' ack='771796936'>

Request: <body rid='771796937' xmlns='' sid='zgnmepnk3'/>
Response: <body xmlns='' ack='771796935'>

Request: <body rid='771796938' xmlns='' sid='zgnmepnk3'/>
Response: <body xmlns='' ack='771796935'>

And the session closed with the error saying not-found.
Request: <body rid='771796939' xmlns='' sid='zgnmepnk3'/>
Response: <body xmlns="" type="terminate" condition="item-not-found"/>

Looks like there are some concurrency issue in code in openfire. This should be fixed.

i am also facing this issue after some hours …

I was having this issue in 4.4.4 openfire, upgrading to 4.7.1 fixed the issue. I need to change the heading of the thread to “BOSH connection in 4.4.4 fails with invalid rid error” but its not allowing now.

The problem happens in the onTimeout method of

This fix on top of in 4.4.4 fixes the actual problem.

-                    deliverOnTimeout(connection);
+                    try {
+                        deliverOnTimeout(connection);
+                    } catch (IOException e) {
+                        setLastResponseEmpty(true);
+                        // This connection timed out we need to increment the request count
+                        if (connection.getRequestId() != lastRequestID + 1) {
+                            Log.warn( "Unexpected RID error - caught IO Exception." + rid + " for session " + streamID + " lastRequestID "+ lastRequestID);
+                            throw new IOException("Unexpected RID error.");
+                        }
+                        lastRequestID = connection.getRequestId();
+                        Log.warn("------- Caught an exception but - set the lastRequestID proper lastRequestID ->"+lastRequestID);
+                        throw new IOException("Unexpected RID error. corrected lastRequestID.");
+                    }