-1

I have applications on servers "A" and "B" (both have Windows Server 2012). Application on "A" creates folder locally. Just after that creation application on "B" checks if folder exists by remote path on server "A". Application on "B" gets false for ~1.5 seconds. After that it begins to get true:

...
//directory.Exists = false
LogInfo(String.Format("Timestamp: {0}", DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture)));
//2016-05-16 13:15:37.281

while (!directory.Exists)
{
    directory.Refresh();
}
//directory.Exists = true
LogInfo(String.Format("Timestamp: {0}", DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture)));
//2016-05-16 13:15:38.546

Parent folder for created folder is shared for user, that is used to run application "A".

Is that a problem with giving permissions for just created folder or some another problem?

Is there any workaround? Because i need to know on application "B" if folder was created and loop while is not a solution.

2 Answers2

0

With limited information (like, is there any replication going on for the UNC path), I would think your problem revolves around SMB2.0.

Try to disable this on server B (via CMD prompt) from this link:

sc.exe config lanmanworkstation depend= bowser/mrxsmb10/nsi 
sc.exe config mrxsmb20 start= disabled

Restart server B once that's done.

SMB2.0 is meant to help with performance by building cache information about UNC shares, but if you need your application needs to check for files by the second (and I had one that did as well), it can negatively affect functionality.

Jake
  • 554
  • 3
  • 10
  • Thanks a lot, also found another post with same problem: http://stackoverflow.com/questions/5159220/windows-file-share-why-sometimes-newly-created-files-arent-visible-for-some-pe So I'm investigating the best solution now. – Dima Glushko May 16 '16 at 14:03
0

Tried different options using information about SMB from this posts:

Windows file share: why sometimes newly created files aren't visible for some period of time?

https://technet.microsoft.com/en-us/library/ff686200(v=ws.10).aspx

Setting DirectoryCacheLifetime to ZERO didn't help. Setting FileNotFoundCacheLifetime to ZERO helped for my situation.

Community
  • 1
  • 1