RuntimeException: A connector with id xxx is already registered

Hello again @artamonov.

The fix you suggested worked for a couple of months but some days ago i started to encounter the following error “RuntimeException: A connector with id xxx is already registered!

Bellow is my code, the same as before, little refactored to get rid of deprecations.

    Connection connection = App.getInstance().getConnection();
    UserSession session = connection.getSession();
    String login = session.getUser().getLogin();
    Locale locale = session.getLocale();

    App.getInstance().logout(() -> {
        try {
            App.getInstance().getConnection().login(new ExternalUserCredentials(login, locale));
        } catch (LoginException e) {
            e.printStackTrace();
        }
    });

I debugged pretty deep and this is the line where the exception is thrown (screenshot below).
What i also noticed is that when it automatically logins, the login method is called twice (one for anonymous user, one for the user that was logged out and should be logged in back). Firstly, the connector is created successfully - secondly, fails, because the connector with the same id was already created as anonymous.

16 AM

Please help!
-c

Hi,

Do you use cuba.testMode = true application property? What platform version do you use?

@artamonov - you little magician.
How did you figured out? :open_mouth:

There is a known issue with this mode that we recently fixed.

@artamonov fixed at which version? we run under platform-6.8.8

In the fresh 6.9.0 https://youtrack.cuba-platform.com/issue/PL-10562

Now cuba.testMode affects only UI tests and does not affect this Ids for performance testing