none
Authenticated Login Errors - Logging in under a single user id, from my application, is generating errors RRS feed

  • Question

  • Can the same user login multiple times to R Server?  We're using a common login and logging in as our application needs to run R-Scripts (passing the code) and sharing a project across all work being done by the user and then logging out when done.  As the throughput increases, multiple clients, we're getting the following errors in the log on the server (catalina.out):

    [DEBUG 09:51:23:454] LiveEngineService activateAuthenticatedSlot: username=testuser, liveCount=1, authSessionLimit=12
    [DEBUG 09:51:23:455] LiveEngineService activateLiveToken: slotConfig=[type:Authenticated, lid:null, liveContext:Temporary Project, httpSession:140E9538C43440681114963A176A72EA, httpSessionIP:10.10.21.150, username:testuser, flagBusyOnCall:false, packageManager:true], nodeToken=[rsizelimit:524288, enabled:true, externalBaseDirectory:C:/Revolution/DeployR-7.3/deployr/external/data, node:NODE-e04412e2-48d6-4206-82c7-d0e84fd4c678, host:localhost, scheme:http, rport:7304, description:Default R processing node, mixed function., name:DeployR Default Node, rpassword:null, rusername:null, type:Mixed Mode]
    [DEBUG 09:51:23:455] LiveEngineService startREngine: slotConfig=[type:Authenticated, lid:null, liveContext:Temporary Project, httpSession:140E9538C43440681114963A176A72EA, httpSessionIP:10.10.21.150, username:testuser, flagBusyOnCall:false, packageManager:true], nodeToken=[rsizelimit:524288, enabled:true, externalBaseDirectory:C:/Revolution/DeployR-7.3/deployr/external/data, node:NODE-e04412e2-48d6-4206-82c7-d0e84fd4c678, host:localhost, scheme:http, rport:7304, description:Default R processing node, mixed function., name:DeployR Default Node, rpassword:null, rusername:null, type:Mixed Mode]
    [DEBUG 09:51:23:455] RServeEngine initEngineConfig: called. {enabled=true, rsizelimit=524288, externalBaseDirectory=C:/Revolution/DeployR-7.3/deployr/external/data, host=localhost, consoleSocketServerPort=7306, rpassword=null, rusername=null, engineOwner=testuser, type=Mixed Mode, engineServer=10.10.21.49, node=NODE-e04412e2-48d6-4206-82c7-d0e84fd4c678, scheme=http, description=Default R processing node, mixed function., rport=7304, name=DeployR Default Node, packageManager=true}
    [DEBUG 09:51:23:455] RServeEngine initEngineConfig: REngine configuration, owner=testuser server=10.10.21.49 packageManager=true scheme=http host=localhost port=7304 cancelPort=7305 socketServerPort=7306 username=null fetchableSizeLimit=524288.0 externalBaseDirectory=C:/Revolution/DeployR-7.3/deployr/external/data
    [DEBUG 09:51:23:455] LiveEngineService startREngine: adjusted slotConfig.lid=PROJECT-37c51163-bc58-4597-9cb6-f38738a88258
    [DEBUG 09:51:23:455] RServeEngine initEngineContext: setting token=PROJECT-37c51163-bc58-4597-9cb6-f38738a88258, httpSession=140E9538C43440681114963A176A72EA
    [DEBUG 09:51:23:455] RServeEngine createSession: on PROJECT-37c51163-bc58-4597-9cb6-f38738a88258 called...
    [DEBUG 09:51:23:472] UserManagerService login: runtime exception=org.grails.datastore.mapping.core.OptimisticLockingException: The instance was updated by another user while you were editing
    [DEBUG 09:51:23:472] UserManagerService login: runtime exception, accountTallyEnabled=true, accountTallyLimit=10
    [DEBUG 09:51:23:472] UserManagerService login: exception handling, existing user=testuser : DeployR API Test Account
    [DEBUG 09:51:23:472] UserManagerService login: testuser : DeployR API Test Account accountTally has been incremented, new tally=1
    [DEBUG 09:51:23:474] ResponseBuilder ResponseMap: called for userContext=null, liveContext=null, httpContext=null, serverError=Do not flush() the Session after an exception occurs
    [ INFO 09:51:23:474] ResponseBuilder DEPLOYR-EVENT[RESPONSE][UNDEFINED][deployr:[response:[call:/r/user/login, error:Internal Server Error: Do not flush() the Session after an exception occurs, errorCode:900, success:false]]]

    Is there a point where a collision can occur logging in under a single user, from an application?  If so, how would you access the API, via an application that needs to login in order to submit to the R-Engine?

    Any help would be greatly appreciated.

    Thanks,

    Scott

    Friday, September 16, 2016 2:39 PM

Answers

  • Well, it appears that the logins can collide if there is enough volume in parallel.  Not sure this is the solution I "like' the best, but it appears that a try/retry scenario does the trick.

    private void Authenticate()
    {
        int numTries = 0;
        int maxRetries = 5;
        bool succeeded = false;
     
        while (numTries < maxRetries)
        {
            try
            {
                rUser = rClient.login(GetAuthenticationToken(AUTH_USER_NAME, AUTH_PASSWORD));
                succeeded = true;
            }
            catch
            {
                // Log Failed Login Attempt(s)
            }
            finally
            {
                numTries++;
            }
            if (succeeded)
                break;
        }
    }

    This is where our code authenticates it's connection to the R Server so it can create sessions and process scripts against the R Engine.

    With this in place the error seems mitigated.  Only the slot limit occurs (on Open, not in enterprise).

    • Marked as answer by sehunley Friday, September 16, 2016 7:08 PM
    Friday, September 16, 2016 4:08 PM