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

MucClient not re-join if failed to join #158

Open
veratiz opened this issue Nov 22, 2021 · 3 comments
Open

MucClient not re-join if failed to join #158

veratiz opened this issue Nov 22, 2021 · 3 comments

Comments

@veratiz
Copy link

veratiz commented Nov 22, 2021

@bgrozev

MucClient.java -> getConnectAndLoginCallable:

            if (!xmppConnection.isAuthenticated())
            {
                logger.info("Logging in.");
                try
                {
                    xmppConnection.login();
                }
                catch (SmackException.AlreadyLoggedInException e)
                {
                    logger.info("Already logged in.");
                }
                catch (Exception e)
                {
                    // We've observed the XMPPTCPConnection get in a broken state where it is connected, but unable to
                    // login (because the locally cached SASL mechanisms supported by the server are empty). We
                    // disconnect in order to trigger a re-connect and clear that state on the next attempt.
                    logger.warn("Failed to login. Disconnecting to trigger a re-connect.");
                    xmppConnection.disconnect();
                    return true;
                }

                try
                {
                    joinMucs();
                }
                catch(Exception e)
                {
                    logger.warn("Failed to join the MUCs.", e);
                    return true;
                }
            }

If xmppConnection successfully connected and logged in, but failed when join, re-join will never happen. For example, when Prosody is rebooted and jicofo not yet reconnected, Jibri throws this exception:

2021-11-22 14:59:16.276 WARNING: [41] org.jitsi.xmpp.mucclient.MucClient.log() Failed to join the MUCs.
org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPP error reply received from jibribrewery@local/jibri-instanse-321207090: XMPPError: not-allowed - cancel [Room creation is restricted]

and this state never changed.

Solution is xmppConnection.disconnect(); after logger.warn("Failed to join the MUCs.", e);

@Neustradamus
Copy link

@veratiz: The problem is always here?

cc: @bgrozev.

@veratiz
Copy link
Author

veratiz commented Feb 4, 2022

@veratiz: The problem is always here?

cc: @bgrozev.

@Neustradamus Yes.

@bgrozev
Copy link
Member

bgrozev commented Feb 4, 2022

Solution is xmppConnection.disconnect(); after logger.warn("Failed to join the MUCs.", e);

Ideally we should stay connected/logged-in and only try to join the MUCs that are not joined. A PR would be welcome. I guess in practice re-connecting is a better behavior than being stuck with the MUCs not joined, so that's also acceptable.

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

No branches or pull requests

3 participants