0

Can anybody explain the purpose for process_login_finish extended event? I trying to catch some events for XE session with this event, but no one messages arrives to the session.

However event "login" successfully captured. But i dont understand why the "new" events like 'process_login_finish' or 'login_event' does not fire?

Microsoft SQL Server 2016 (SP2-CU6) (KB4488536) - 13.0.5292.0 (X64) Mar 11 2019 23:19:30 Copyright (c) Microsoft Corporation Enterprise Edition: Core-baseed Licensing (64-bit) on Windows Server 2012 R2 Standard 6.3 (Build 9600: )

0

1 Answer 1

1

While testing on SQL Server 2019, it looks like that process_login_finish event is only fired when a new session is established.

I have a .NET application that I've set Application Name=My Test App in the connection string. It connects to a database (database_id 7 in this case) and runs queries. When I start this app up for the first time, I can check the XE and sys.dm_exec_sessions:

screenshot of XE session live data in SSMS showing several login events, and only one process_login_finish event

SELECT * 
FROM sys.dm_exec_sessions s 
WHERE s.program_name = 'My Test App';

screenshot of dm_exec_sessions results in SSSMS showing only one row with application name of My Test App

As you can see, the event fired once, and my app has established one session on the server.

The connection pooling feature built into the SqlClient driver means that, if the application isn't under very much load, the same session will continue to be used. Thus I would rarely see this process_login_finish event fire.

If I cause the app to run a bunch more queries, eventually it will create more connections and add them to the pool, and that event will fire each time this occurs:

screenshot of XE session live data in SSMS showing more login events, and two more process_login_finish events

screenshot of dm_exec_sessions results in SSSMS showing only three rows with application name of My Test App

As you can see, eventually process_login_finish fired two more times, and I now have three sessions established from my app.

A certain amount of inactivity can cause the session to go away, in which case the next time the app connects, we'll see process_login_finish fire again.

Note: in my testing above, I never saw the login_event event fire, although it was included in my XE session definition.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.