SBX - Search With Button

SBX - Forum Post Title

How session ID in AX 2012 is generated

Microsoft Dynamics AX Forum

Chaidir Ali Assegaf asked a question on 12 Jun 2019 11:18 PM

Question Status

Suggested Answer

Hi Experts,

I'm a Junior Developer of Dynamics AX 2012 R3.

I have some question about how session id is generated in AX 2012.

what I know is, the number that generated in the session id is increment-based, and always increments whenever the user logged in. and the increment behavior is always incrementing and not using session id that has been used even tough that session id is not used by any user or process.

Is my opinion correct? can you give me the right explanation about it?

Thanks,
Chaidir Ali Assegaf

Reply
Chaidir Ali Assegaf responded on 13 Jun 2019 2:33 AM

Hi Sukrut,

Thanks for your answer, I appreciate it.
But, after I read the thread, I find that the thread doesn't answer my question.

Here's some additional information :
I have already checked the CREATEUSERSESSIONS Stored Procedure, and see how it works.
the code is looking for the biggest value of session ID with max(SessionID) + 1

SELECT @max_val = MAX(SESSIONID) + 1
FROM SYSCLIENTSESSIONS WITH (UPDLOCK)

after it retrieves the biggest value of session ID, the next process is inserting that value with another parameter needed into SYSCLIENTSESSION Table.

INSERT INTO SYSCLIENTSESSIONS (SESSIONID, SERVERID, VERSION, LOGINDATETIME, USERID, SID, USERLANGUAGE, HELPLANGUAGE, CLIENTTYPE, SESSIONTYPE, RECID, CLIENTCOMPUTER, STATUS, DATAPARTITION) VALUES (@max_val, @serverid, @versionid, @loginDateTime, @userid, @sid, @lanExt, @manExt, @clientType, @sessionType, @recid, @computerName, 1, @dataPartition)

the code seems working if you see it at a glimpse.

I decided to test it with a user, creating many sessions with it, and see if the number is incrementing like the code is written.

the test result is :

if You see at the result, the session ID is not increasing by the time when the user logged in, it's more like the number was generated randomly.

that's about it.

Thanks,
Chaidir Ali Assegaf

Reply
Chaidir Ali Assegaf responded on 13 Jun 2019 2:39 AM

Deleted post

Reply
Blue Wang responded on 13 Jun 2019 2:53 AM
My Badges

Hi Chaidir,

Some Web servers generate session IDs by simply incrementing  numbers.

However, most servers use algorithms that involve more complex methods.

Reply
magic1949 responded on 13 Jun 2019 7:01 AM
My Badges
Suggested Answer

The Ax server uses a connection pool where connections are given to a session on an on-demand basis from a cache. So,  you might not see an SPID for a particular session at that instant when that session is not executing a SQL statement.

CREATESERVERSESSIONS stored procedure  is invoked during the startup of an AOS server and it  populates the SysServerSessions table..

CREATEUSERSESSIONS stored procedureis invoked each time a client is launched and populates the SysClientSessions table.

Session types include: User, Worker, Web User, Business connector, impersonated session

Reply
magic1949 responded on 13 Jun 2019 7:01 AM
My Badges
Suggested Answer

The Ax server uses a connection pool where connections are given to a session on an on-demand basis from a cache. So,  you might not see an SPID for a particular session at that instant when that session is not executing a SQL statement.

CREATESERVERSESSIONS stored procedure  is invoked during the startup of an AOS server and it  populates the SysServerSessions table..

CREATEUSERSESSIONS stored procedureis invoked each time a client is launched and populates the SysClientSessions table.

Session types include: User, Worker, Web User, Business connector, impersonated session

Reply

SBX - Two Col Forum

SBX - Migrated JS