KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
We were faced with very strange issue that made us crazy. Sometimes newly created files on our File Share PC were "absent" for some period of time. To reproduce a problem you should have at least two computers, call them alpha and beta . Create file share on beta PC ( \\beta\share\bug ) and run this PowerShell script from alpha PC: param( $sharePath="\\beta\share\bug" ) $sharePC = ($sharePath -split '\\')[2] $session = New-PSSession -ComputerName $sharePC $counter = 0 while ($true) { $fileName = $sharePath + "\$counter.txt" Invoke-Command -Session $session -ScriptBlock { param( $fileName ) "" > $fileName } -ArgumentList $fileName if (Test-Path $fileName) { Write-Host "File $fileName exists" -fore Green } else { Write-Host "!!! File $fileName does NOT exist!" -fore Red } $counter = $counter + 1 Start-Sleep 2 } After starting this script you should be able to see these messages: File \\beta\share\bug\1.txt exists File \\beta\share\bug\2.txt exists ... And now : Open cmd.exe and run this command: if exist \\beta\share\bug\foo.txt echo 1 After this during approx 10 seconds you'll see following messages: !!! File \\beta\share\bug\3.txt does NOT exist! !!! File \\beta\share\bug\4.txt does NOT exist! We've discovered that bug is caused by enumerating shared directory where new files are being created. In Python call os.listdir('//beta/share/bug') to reproduce a bug. In C# : Directory.GetDirectories(@"\\beta\share\bug") . You can even simply navigate to share directory by shell and call ls or dir . Bug were found on Windows Server 2008 R2 Note, that you cannot watch directory content on alpha</code
Tags (comma-separated)
Save Edits
Cancel