Hi,
I have recently implemented this code in an Event Subscriber, subscribing to the OnBeforeCompanyOpen event.
The aim is to limit RTC users to one session, as we believe users opening multiple sessions may be having some impact on performance.
IF (SESSION.CURRENTEXECUTIONMODE = EXECUTIONMODE::Standard) AND (SESSION.CURRENTCLIENTTYPE = CLIENTTYPE::Windows) THEN BEGIN
ActiveSession.SETRANGE("User ID",USERID);
ActiveSession.SETRANGE("Client Type",ActiveSession."Client Type"::"Windows Client");
IF ActiveSession.COUNT > 1 THEN
ERROR(ErrTooManyOpenSessions);
END;
Today whilst testing we ran into a problem. If a users session crashes, and they end the task session with Task Manger, it seems the session is not cleaned up. So therefore the user is left with no session open, but they are unable to access the RTC until someone cleans that session up.
I am wondering if anyone has any suggestions on how to handle this? Or is there an even better way to handle this?
Thanks in advance.
Nick
Answers
I would take my battle elsewhere, hardware first, then analysis using sql profiler, to find the real problem.
Best Regards
Hardware? Does the hardware really have that much of an impact? I was always under the impression that the network speed is more likely to be the issue than hardware if you have the minimum requirements for NAV?
This is already in a Custom Codeunit, and I am already subscribing to the event you mentioned. I have modified this, so it prompts the user to confirm if they want to open a new session. (If another session is found). It then loops and kills all the other sessions.
Everything happens on the server, not the client.
So yes hardware is important!
Requirements depends on a lot of things. But disk performance is important for sql and memory for NAV server for caching.
In terms of performance problem solution, I join the previous speakers in this post.
There are couple of tools for SQL to retrieve the top10 most performance-hungry statements.
In regards to the code above,
it is not possible to identify "lost" sessions from NAV.
In the ServierTier administration you are able to configure a "Close Inactive SQL Connections". The standard value is 10 minutes. Play a little bit around with it.
Alternatively search for "session kill" here in the forum.
Of course, alternatively you could also find out, why your users are forced to end NAV using Task Manager. It's not the normal approach :-)
Good luck
Maybe not a flag but let the SUPER relogin. Then check the login time+1 in your IF