Skip to content

MucClient not re-join if failed to join #158

@veratiz

Description

@veratiz

@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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions