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

possibly bug in XmppBoshConnection on connection failure #27

Open
ashward opened this issue Aug 16, 2011 · 2 comments
Open

possibly bug in XmppBoshConnection on connection failure #27

ashward opened this issue Aug 16, 2011 · 2 comments
Labels
Milestone

Comments

@ashward
Copy link
Member

ashward commented Aug 16, 2011

Reported by bernd.roessl, May 24, 2011

If emite is not able to connect to the backend it will do 8 retries with an increasing delay (see RetryControl) as long as the error count does not get reset. Each time emite handles a resonse in XmppBoshConnection it will reset the error count and so RetryControl will not do it's purpose.

What steps will reproduce the problem?

  1. you need a unresponsive jabber server behind responsive reverse proxy
  2. try to connect to jabber server
  3. reverse proxy will responde with status 502

What is the expected output? What do you see instead?

emite should try to connect 8 times with more delay on each retry. But instead it retries forever with a delay of 500ms.

If clearErrors(); will be done just on a successful response the onError handler will pass a proper error-count to RetryControl.

@fdewasmes
Copy link

Hi,

I've worked a bit on this one. Here is a patch. I didn't run the tests as they don't compile and are even deactivated in the pom file :S

diff --git a/src/main/java/com/calclab/emite/core/client/bosh/XmppBoshConnection.java b/src/main/java/com/calclab/emite/core/client/bosh/XmppBoshConnection.java
index 6dcf82a..a4dee20 100644
--- a/src/main/java/com/calclab/emite/core/client/bosh/XmppBoshConnection.java
+++ b/src/main/java/com/calclab/emite/core/client/bosh/XmppBoshConnection.java
@@ -84,7 +84,7 @@ public class XmppBoshConnection extends XmppConnectionBoilerPlate {

        @Override
        public void onResponseReceived(final int statusCode, final String content, final String originalRequest) {
  •           clearErrors();
    
  •           // clearErrors();
            activeConnections--;
            if (isActive()) {
                // TODO: check if is the same code in other than FF and make
    
    diff --git a/src/main/java/com/calclab/emite/reconnect/client/SessionReconnect.java b/src/main/java/com/calclab/emite/reconnect/client/SessionReconnect.java
    index 5f8fe55..a9ac9d7 100644
    --- a/src/main/java/com/calclab/emite/reconnect/client/SessionReconnect.java
    +++ b/src/main/java/com/calclab/emite/reconnect/client/SessionReconnect.java
    @@ -78,7 +78,7 @@ public class SessionReconnect {
    }.schedule((int) (1000 * seconds));
    logger.info("Reconnecting in " + seconds + " seconds.");
    }
  •           } else if (event.is(SessionStates.ready)) {
    
  •           } else if (event.is(SessionStates.loggedIn)) {
                logger.finer("CLEAR RECONNECTION ATTEMPS");
                reconnectionAttempts = 0;
            }
    
    @@ -88,7 +88,7 @@ public class SessionReconnect {
    connection.addConnectionStateChangedHandler(new ConnectionStateChangedHandler() {
    @OverRide
    public void onStateChanged(final ConnectionStateChangedEvent event) {
  •           if (event.is(ConnectionState.error) || event.is(ConnectionState.waitingForRetry)) {
    
  •           if (event.is(ConnectionState.error)) {
                shouldReconnect();
            }
        }
    

@ashward
Copy link
Member Author

ashward commented Aug 19, 2011

Hi!

Thanks for the patch.

I was just commenting on the issue you raised in the old google code bug tracker! I haven't had a chance to test your patch properly, but I've committed your patch to a new branch named issue-12 which is an existing issue we have to overhaul the reconnect system as it's a bit flakey at the moment. I hope that we can use this issue-12 branch to make the reconnection system a lot more solid.

https://github.com/EmiteGWT/emite/commits/issue-12

I have actually fixed the unit tests now so they should be working (and run fine for your patch too).

Use "mvn test" to run the POJO unit tests and "mvn integration-test" to run the (not many!) GWT tests.

Thanks,

Ash

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

No branches or pull requests

2 participants