[MNT-12290] disconnectClientSessions assumptions don't work on Terminal Servers Created: 28-Apr-14  Updated: 26-Aug-16  Resolved: 25-Nov-14

Status: Closed
Project: Service Packs and Hot Fixes
Component/s: JLAN
Affects Version/s: 4.2.2
Fix Version/s: 4.2.4

Type: Service Pack Request
Reporter: Mark Rogers [X] (Inactive) Assignee: Closed Bugs
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0 minutes
Time Spent: 2 days, 2 hours
Original Estimate: Not Specified

Issue Links:
Cloners
is cloned by MNT-12730 CLONE - disconnectClientSessions assu... Closed
Related
Bug Priority:
Category 2
ACT Numbers:

00181376,00192771

Build Location: http://releases.alfresco.com/Enterprise-4.2/4.2.4/build-00082/ALL/

 Description   

Symptom:
When two users on a Terminal Server running Windows Server 2008 R2 tries to connect to Alfresco CIFS-share at the same time one off them gets disconnected.

How to reproduce:
1. Mount your Alfresco CIFS-share on E:
2. Log on to a Terminal Server instance with two users.
3. Go to share E:
4. Press F5 at the same time on both computers at the same time. (sometime it needs multiple F5 but not always)

Fixing the problem:
I've been looking through the code making the disconnect and found that the Alfresco assumes that if you come from the same RemoteAddress or RemoteName then you are the same user. Resulting in the problem with disconnecting users on Terminal Servers.

The code can be found in function disconnectClientSessions() (SMBSrvSession.java) and lookes like this:
// Check for an address/client name match

if ( curSess.getSessionId() != getSessionId()) {

// Check the IP address

if ( hasRemoteAddress() && curSess.hasRemoteAddress()) {

// Check if the IP addresses match

if ( getRemoteAddress().equals( curSess.getRemoteAddress()))

{ addrMatch = true; addrStr = getRemoteAddress().getHostAddress(); }

}
else if ( hasRemoteName() && curSess.hasRemoteName()) {

// Check if the remote NetBIOS names match

if ( getRemoteName().equals( curSess.getRemoteName()))

{ addrMatch = true; addrStr = getRemoteName(); }

}
}

// Check if the session matches the current session address/client name

if ( addrMatch == true)

{ // DEBUG if ( Debug.EnableInfo && hasDebug(DBG_NEGOTIATE)) debugPrintln("Disconnect existing session from " + addrStr + ", sess=" + curSess); // Disconnect the existing session //curSess.closeSession(); // Update the disconnected session count discCnt++; }

Debug log:
13:33:38,041 DEBUG [org.alfresco.fileserver] [AlfJLANWorker21] [SMB] Packet pool stats: [BufferLists: [Bufsize=256,Init=20,Max=100,Avail=20,Alloc=0,Stats=114/0/0] [Bufsize=4096,Init=20,Max=50,Avail=20,Alloc=0,Stats=2/0/0] [Bufsize=16384,Init=5,Max=50,Avail=5,Alloc=0,Stats=0/0/0] [Bufsize=66000,Init=5,Max=50,Avail=5,Alloc=0,Stats=6/0/0] ]
13:33:38,041 DEBUG [org.alfresco.fileserver] [AlfJLANWorker21] Processed 4 packets for addr=xxx.xxx.xxx.xxx in one thread run (max=4)
13:33:38,042 DEBUG [org.alfresco.fileserver] [AlfJLANWorker23] Worker AlfJLANWorker23: Req=[NIO CIFS Sess=T5]
13:33:40,706 DEBUG [org.alfresco.fileserver] [AlfJLANWorker2] [SMB] NT Session setup from user=user1, password=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, ANSIpwd=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, domain=DOMAIN, os=, VC=0, maxBuf=0, maxMpx=4, authCtx=[NTLM,Challenge=8a8f33298defe126]
13:33:40,707 DEBUG [org.alfresco.fileserver] [AlfJLANWorker2] [SMB] MID=2776, UID=0, PID=65279
13:33:40,708 DEBUG [org.alfresco.fileserver] [AlfJLANWorker25] [T6] NT NotifyChange fid=0, mid=39025, filter=0x17, dir=\, maxQueue=0
13:33:40,708 DEBUG [org.alfresco.fileserver] [AlfJLANWorker25] [T6] Added new request, [T6:\:File,Dir,Attr,Write,NoTree MID=39025 PID=2760 TID=1 UID=1,Queue=0]
13:33:40,708 DEBUG [org.alfresco.fileserver] [AlfJLANWorker25] [T6] Global notify mask = 0x17, reqQueue=1
13:33:40,708 DEBUG [org.alfresco.fileserver] [AlfJLANWorker25] [SMB] Packet pool stats: [BufferLists: [Bufsize=256,Init=20,Max=100,Avail=20,Alloc=0,Stats=122/0/0] [Bufsize=4096,Init=20,Max=50,Avail=19,Alloc=1,Stats=3/0/0] [Bufsize=16384,Init=5,Max=50,Avail=5,Alloc=0,Stats=0/0/0] [Bufsize=66000,Init=5,Max=50,Avail=5,Alloc=0,Stats=6/0/0] ]
13:33:40,708 DEBUG [org.alfresco.fileserver] [AlfJLANWorker25] Processed 4 packets for addr=xxx.xxx.xxx.xxx in one thread run (max=4)
13:33:40,710 DEBUG [org.alfresco.fileserver] [AlfJLANWorker2] [SMB] User user1 logged on (type Unknown)
13:33:40,711 DEBUG [org.alfresco.fileserver] [AlfJLANWorker2] [SMB] Allocated UID=1 for VC=[0:1,[user1:[B@6313647e,DOMAIN,,xxx.xxx.xxx.xxx,Unknown],Tree=0,Searches=0]
13:33:40,711 DEBUG [org.alfresco.fileserver] [AlfJLANWorker2] [T7] Disconnect existing session from xxx.xxx.xxx.xxx, sess=[Session id=6,unique=T6,proto=TCP-SMB]
13:33:40,711 DEBUG [org.alfresco.fileserver] [AlfJLANWorker2] [T6] Cleanup session, vcircuits=1, changeNotify=1
13:33:40,714 DEBUG [org.alfresco.fileserver] [AlfJLANWorker2] [T6] Cleanup vc=[0:1,[user2:[B@3b882275,DOMAIN,,xxx.xxx.xxx.xxx,Normal],Tree=1,Searches=0]
13:33:40,714 DEBUG [org.alfresco.fileserver] [AlfJLANWorker2] [T6] Cleanup vc=0, UID=1, searches=0, treeConns=1
13:33:40,715 DEBUG [org.alfresco.fileserver] [AlfJLANWorker2] [T6] State changed to NBHANGUP
13:33:40,715 DEBUG [org.alfresco.fileserver] [AlfJLANWorker2] [T7] Disconnect existing session from xxx.xxx.xxx.xxx, sess=[Session id=5,unique=T5,proto=TCP-SMB]
13:33:40,715 DEBUG [org.alfresco.fileserver] [AlfJLANWorker2] [T5] Cleanup session, vcircuits=0, changeNotify=1
13:33:40,715 DEBUG [org.alfresco.fileserver] [AlfJLANWorker2] [T5] State changed to NBHANGUP



 Comments   
Comment by Mark Rogers [X] (Inactive) [ 28-Apr-14 ]

Aithor of this issue is sysadmin2012.

Moved to JLAN project. Issue was raised in the forms and I asked for this issue to be created in JIRA.

Generated at Thu Jul 09 10:11:00 BST 2020 using JIRA 7.6.3#76005-sha1:8a4e38d34af948780dbf52044e7aafb13a7cae58.