MultiEnvironment single user context fails to login after x attempts and wont connect again till application restarted

Hi,

I have been having issues for a few months now when using MultiEnvironment.CreateSingleUserContext it will work for a random number of logins and then it will start failing to login and wont recover until I restart the program sometimes this can be after just a couple of login attempts other times it can successfully login 500 times before seeing it happen.

Its happening on multiple servers we have access too, but not on all of them.

I have modified the SystemStatusClientConsole demo to show this where it logs in then logs out straight away, waits a second before logging in again, hopefully you can point out if I am missing something or if there is an issue.

Here is an example output where it shows after 71 successful logins/logouts it then fails to connect and doesn’t restore, I have confirmed the server is still up and accessible while the program is failing to connect.

GetLastException returns nothing and there are no errors logged in the ProgramData\Milestone\MIPSDK folder.

I am using SDK version 26.1.2 and some of the milestone versions I have noticed this on is 2020 R3 Ver.20.3a Build 93 and 2019 R3 Ver. 13.3a Build 44

Successfully logged in: 67
Successfully logged in: 68
Successfully logged in: 69
Successfully logged in: 70
Successfully logged in: 71
Failed to login: 1
Failed to login: 2
Failed to login: 3
Failed to login: 4
Failed to login: 5

Here is the modified demo

VideoOS.Platform.SDK.Environment.Initialize();
EnvironmentManager.Instance.EnvironmentOptions[EnvironmentOptions.ConnectionCheckTimeout] = "30";
MultiEnvironment.InitializeUsingUserContext();

int success = 0;
int failed = 0;

while (true)
{
    var userContext = MultiEnvironment.CreateSingleServerUserContext(false, userName, password, true, serverAddress.Uri, false);

    bool loginSucceeded = MultiEnvironment.LoginUserContext(userContext);
    if (loginSucceeded == false)
    {
        failed++;

        Console.WriteLine($"Failed to login: {failed}");               
    }
    else
    {
        success++;

        Console.WriteLine($"Successfully logged in: {success}");

        var multiSession = new SystemStatusClient(userContext.Configuration.ServerFQID);
        multiSession.StopAndRemoveSessions(true);
    }

    Thread.Sleep(1000);
    MultiUserEnvironment.RemoveUserContext(userContext);
}

Thanks for any help,

Danny

I have started a test run here. I have already far surpassed the numbers you mention.

Is there a pattern on the version of the XProtect VMS or have you seen it work and fail on the same version? What are the versions you have tested? Is there any other pattern you can think of?

If you have tested both with users than are in the administrators role and users that are not, does it make a difference? If you have only tested one of these options, which?

Do you test servers have a big configuration i.e. many cameras? Might there be a pattern that the “big” server is more likely to fail?

Hi,

It seems to only be happening on our older servers,

  1. 2020 R3 Ver.20.3a Build 93 - 60 cameras
  2. 2020 R3 Ver.20.3a Build 93 - 10 cameras
  3. 2020 R2 Ver.20.2a Build 4122 - 30 cameras
  4. 2019 R3 Ver. 13.3a Build 44 - 10 cameras

I have done more testing and it doesn’t seem to happen on any of our servers newer than 2021 R1.

I login using AD and have some of the affected servers that are admins and some that are not.

Thanks

Milestone does not support the mentioned versions anymore (see Lifecycle for XProtect® Video Management Software).

While we understand these versions may still be in use, this means there will be no formal investigation into this issue.

If this is critical for you, we recommend upgrading, or alternatively implementing a suitable workaround on your side (if possible).