Perpetual SMB Sessions

Get help for specific problems
Posts: 2
Joined: 17 Feb 2016

DoubleJava

I have an issue where SMB sessions seem to last forever and accumulate until the machine will no longer accept new connections. Here is the scenario:

We have a Windows Server 2012 R2 machine, which hosts a file share. I have setup FreeFileSync on this server and am using the Task Scheduler on this server to invoke a FreeFileSync batch file once every hour to mirror (one-way) a copy of the file share to a Windows 7 workstation. This Windows 7 workstation isn't normally used by anyone; it just runs 24x7 to receive the syncs from the server. The idea is that if the server goes down, we can still continue to limp along using the Workstation until the server is fixed.

So, there is a single file share on the server and a single file share on the workstation. All client machines attach only to the file share on the server. The only thing that connects to the file share on the workstation is FreeFileSync. Since FreeFileSync is only sending the deltas (adds, deletions, changes), it usually runs for only about one or two minutes each time it is invoked by the Task Scheduler.

If you reboot the Windows 7 workstation (or otherwise blow away all SMB connections to the workstation), then the whole process works perfectly for several hours. However, after several hours Task Scheduler starts to show failure codes (0x2) rather than success codes (0x0). Upon inspecting FreeFileSync's log, it says that the failures are due to the target (the Windows 7 Workstation) having too many sessions. Sure enough, when you go to the workstation and look at the Sessions in Computer Management, there are a bunch of sessions listed and they are all from the FreeFileSync service account, and they are all listed as 'idle'.

I realize that Windows 7 has a much more limited number of allowed connections compared to Windows Server. However, I don't understand why these connections persist. FreeFileSync runs for two minutes and then doesn't run again for an hour. You would think that the connection would go away after a period of inactivity, but, instead, the connections seem to persist forever. There is a Group Policy setting called, "Microsoft network server: Amount of idle time required before suspending session"; the default is 15 minutes, but even reducing it to 1 minute had no effect. I tried reducing the sync frequency to once every two hours rather than once per hour, but the same thing occurs; although, it takes twice as long before the number of allowed connections maxes out.
Posts: 2
Joined: 17 Feb 2016

DoubleJava

Here is an update for anyone that might be interested:

I am currently working with Microsoft on this issue to see if it can be resolved through tweaking Windows. The case is still open at this point, but here is the current status:

1) Microsoft says that they believe the issue is that FreeFileSync isn't closing the SMB connections, so they end up persisting indefinitely. They say that they have seen this happen with other third-party applications before. I will update this bullet-point if we end up deciding that this isn't the case.

2) I recreated the above stated solution using RoboCopy rather than FreeFileSync. I created a batch file that calls RoboCopy, and then I created a scheduled task - using Windows Task Scheduler - that calls the batch file. The RoboCopy solution does not result in persistent sessions - sessions close within about 10 seconds of the end of the task. Both solutions use the Windows Task Scheduler, so it would seem that the Windows Task Scheduler is not the problem. Both solutions are using the same service account, so the service account doesn't seem to be the problem. I'm running both solutions on the same equipment, so the issue doesn't seem to be specific to the server or to the workstation. At this point, the issue does seem to be specific to FreeFileSync.

Another data point: When I run FreeFileSync in GUI mode, I don't seem to have any issues. It's only when running FreeFileSync in batch mode that the issue occurs.

Hopefully, someone has a fix; I would prefer to use FreeFileSync rather than RoboCopy.
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

Indeed this problem is for FreeFileSync to solve. I'll have a proper review and report back.
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

I've revised FreeFileSync's network handling to follow Windows Explorer in behavior:

- Establish new network connections only when needed
- Show only a single login dialog per network share
- Show login dialogs for the same network address one after another

Here's the new beta version: http://www.mediafire.com/download/1gq2scrl4dxm55u/FreeFileSync_8.1_beta_Windows_Setup.exe
Posts: 8
Joined: 7 Apr 2016

jmpr

Hello Zenju. Is this related to this?: viewtopic.php?t=2300#p10121

I only open connection before using FreeFileSync, by running a bat file with "net use x: ....."

Then I close them. But with teh last version FFS doesn't "see" the network drives, and I have not changed a thing. It doens' see them in its file explorer yet (when you select pairs).

Thanks
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

Hello Zenju. Is this related to this?: https://freefilesync.org/forum/viewtopic.php?t=2300#p10121jmpr
The topic of this thread are remnant network sessions while the linked thread is about network visibility, so no, they're not related.
Posts: 8
Joined: 7 Apr 2016

jmpr

Ok, I only need a solution for the problem in that topic, and there are no responses. I thought SMB sessions might be related. I don't know what to do to solve it.
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

Ok, I only need a solution for the problem in that topic, and there are no responses. I thought SMB sessions might be related. I don't know what to do to solve it.jmpr
Sure, but don't hijack unrelated topics and rather post to the one that is relevant.
Posts: 8
Joined: 7 Apr 2016

jmpr

Ok, I'm sorry. I thought it may be related.

Should I start a new topic to try to solve my problem?
Posts: 1
Joined: 14 Oct 2016

SharedMedia

Hello,
Same issue reported here.. using Windows Server 2012R2 (current patch level) (both servers);

Installed v 8.5, previously a few months back, we used 8.0 with no issues.

when running a sync (update).. from GUI, works GREAT!, saved session as Batch File, created windows task (basic) using SYSTEM, task runs ok, and log file has this error:

Cannot find the following folders:
\\servername\foldername

However you CAN access this from any form.. explorer, GUI search, file patch, cli..
I believe there may be a security setting missed in the code, as 2012/2012R2 may send the request for folder access via "software" and not computer..

Great software, thanks for the tool; hope we can resolve
Posts: 1
Joined: 1 Jan 2017

QsKk3

I've been having this issue as well with 8.7. I'm not sure what version I upgraded from though… But it may have been a while. I've had these batch jobs going for years that would email me when they fail, and for the past two weeks I've been getting nothing but failures whenever they run. It's the same message.

Error: Cannot find the following folders:
\\SERVERNAME\Folder\

I did everything from delaying the tasks to forcing it to wait for specific network connections but that didn't change anything.

If I just run them manually, they work perfectly and there are no errors.
Posts: 1
Joined: 24 Jan 2017

Biure

I think I had crashes similar to those described above. Though, before such problems was not. Why it seems to me that this may be due to the fact that I switched to a new proxy (advanced.name if matters) and have configured incorrectly the network.