Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-12290

disconnectClientSessions assumptions don't work on Terminal Servers


    • Type: Service Pack Request
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 4.2.2
    • Fix Version/s: 4.2.4
    • Component/s: JLAN
    • Labels:


      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


          Issue Links




                • Assignee:
                  closedbugs Closed Bugs (Inactive)
                  mrogers Mark Rogers [X] (Inactive)
                • Votes:
                  0 Vote for this issue
                  14 Start watching this issue


                  • Created:

                    Time Tracking

                    Original Estimate - Not Specified
                    Not Specified
                    Remaining Estimate - 0 minutes
                    Time Spent - 2 days, 2 hours
                    2d 2h

                      Structure Helper Panel