Director is showing duplicate sessions

Director is showing duplicate sessions

book

Article ID: CTX285009

calendar_today

Updated On:

Description

Duplicate sessions under 'Multi-session OS Machines' tab although the number of sessions is different in Studio

Resolution

Tried as per

https://support.citrix.com/article/CTX239749
  • Removing the stale Machine ID from the MonitorData.Machine Table, it failed due to references to this Machine ID in the MonitorData.Session Table:

ERROR:

2 objects are affected & show IP = “n/a“ in Director

Upon running the second command I get an error stating:

Msg 547, Level 16, State 0, Line 3

The DELETE statement conflicted with the REFERENCE constraint "Session_Machine". The conflict occurred in database "CTX-XD-SiteMonitoring", table "MonitorData.Session", column 'MachineId'.

The statement has been terminated.

RESOLUTION

In  MonitorData.Machine Table

> Select * From [MonitorDB].[MonitorData].[Machine] WHERE Name Like ‘%ctxapp25%’

In MonitorData.Session Table

> SELECT * FROM [MonitorDB].[MonitorData].[Session] WHERE MachineId = ‘Stale MachineId'

We then replaced ID of old Machine Id with the New Machine Id in the MonitorData.Session Table:

> UPDATE [MonitorDB].[MonitorData].[Session] SET MachineId='New Machine Id' WHERE MachineId='Old Machine Id'

Next, we navigated back to the MonitorData.Machine Table, and removed the Old Stale Machine as per the following:

> DELETE FROM [MonitorDB].[MonitorData].[Machine] WHERE ID = ‘Old Machine Id’

After successfully removing the Stale Machine Id from the MonitorData.Machine Table and Updating the Old Records in the MonitorData.Session Table, we restarted the Citrix Monitor Service on Both Delivery Controllers and we could see that there was no issues with Duplicate Entries in Citrix Director.


Problem Cause

We tested as per

https://support.citrix.com/article/CTX239749
  • However this would not resolve the issue.. When we tried to remove the stale Machine ID from the MonitorData.Machine Table, it failed due to references to this Machine ID in the MonitorData.Session Table:


ERROR:

2 objects are affected & show IP = “n/a“ in Director

 

Upon running the second command I get an error stating:

 

Msg 547, Level 16, State 0, Line 3

The DELETE statement conflicted with the REFERENCE constraint "Session_Machine". The conflict occurred in database "CTX-XD-SiteMonitoring", table "MonitorData.Session", column 'MachineId'.

The statement has been terminated.

image.png


RESOLUTION

In  MonitorData.Machine Table


> Select * From [MonitorDB].[MonitorData].[Machine] WHERE Name Like ‘%ctxapp25%’

 


In MonitorData.Session Table


> SELECT * FROM [MonitorDB].[MonitorData].[Session] WHERE MachineId = ‘Stale MachineId'


We then replaced ID of old Machine Id with the New Machine Id in the MonitorData.Session Table:


> UPDATE [MonitorDB].[MonitorData].[Session] SET MachineId='New Machine Id' WHERE MachineId='Old Machine Id'

 


Next, we navigated back to the MonitorData.Machine Table, and removed the Old Stale Machine as per the following:


> DELETE FROM [MonitorDB].[MonitorData].[Session] WHERE ID = ‘Old Machine Id’

 


After successfully removing the Stale Machine Id from the MonitorData.Machine Table and Updating the Old Records in the MonitorData.Session Table, we restarted the Citrix Monitor Service on Both Delivery Controllers and we could see that there was no issues with Duplicate Entries in Citrix Director.