Windows中的PrivCopyFileExW错误?
我发出了许多并行robocopy调用,将文件从一个网络共享复制到一个目录中.由于文件是只读的,我告诉robocopy通过/ A-:R剥离目标目录中的只读属性.似乎在一些核心机器(12个或更多)的目标目录!锁定最多16秒.
当并发MSBuild任务正在运行且CopyFile任务在只读文件上执行时,此问题确实浮出水面.当执行robocopy以从网络共享并行下载TFS构建的依赖项时,也会发生这种情况.由于所有这些问题都指向kernel32 CopyFile(或其私有实现),我怀疑该问题与Windows如何复制文件有关. 这似乎不是内核中的一般问题,因为临时文件夹源于必须可以并发访问目录这一事实.但是CopyFile的kernel32.dll里面的用户模式实现似乎有缺陷. 更新2 更新3 procmon堆栈跟踪确实表明魔术发生在kernel32.dll里面 这是一些procmon输出这个问题的感觉. 为什么PrivCopyFileExW会设法锁定目录?文件系统应该能够支持将文件复制到一个目录中.我正在使用Windows Server 2008 R2和一些带有RAID阵列,SSD等的最新多核机器. 这似乎与CopyFile in kernel32.dll报告的问题有关,直到今天才解决.我可以排除病毒扫描程序,因为这也发生在没有安装的机器上. 更新1 似乎另一个robocopy进程会尝试将文件复制到打开目录的目标目录 Date & Time: 20.03.2012 08:30:06 Event Class: File System Operation: CreateFile Result: SUCCESS Path: C:tempdest TID: 11672 Duration: 0.0000150 Desired Access: Read Data/List Directory,Write Data/Add File,Write EA,Read Attributes,Write Attributes,Delete,Synchronize Disposition: OpenIf Options: Directory,Synchronous IO Non-Alert,Open For Backup Attributes: D ShareMode: None <---- No sharing AllocationSize: 0 OpenResult: Opened 0 fltmgr.sys FltpPerformPreCallbacks + 0x2f7 0xfffff88001045027 C:Windowssystem32driversfltmgr.sys 1 fltmgr.sys FltpPassThroughInternal + 0x4a 0xfffff880010478ca C:Windowssystem32driversfltmgr.sys 2 fltmgr.sys FltpCreate + 0x293 0xfffff880010652a3 C:Windowssystem32driversfltmgr.sys 3 ntoskrnl.exe IopParseDevice + 0x5a7 0xfffff800031cb537 C:Windowssystem32ntoskrnl.exe 4 ntoskrnl.exe ObpLookupObjectName + 0x585 0xfffff800031c1ba4 C:Windowssystem32ntoskrnl.exe 5 ntoskrnl.exe ObOpenObjectByName + 0x1cd 0xfffff800031c6b7d C:Windowssystem32ntoskrnl.exe 6 ntoskrnl.exe IopCreateFile + 0x2b7 0xfffff800031cd647 C:Windowssystem32ntoskrnl.exe 7 ntoskrnl.exe NtCreateFile + 0x78 0xfffff800031d7398 C:Windowssystem32ntoskrnl.exe 8 ntoskrnl.exe KiSystemServiceCopyEnd + 0x13 0xfffff80002eca813 C:Windowssystem32ntoskrnl.exe 9 ntdll.dll NtCreateFile + 0xa 0x7718fc0a C:WindowsSystem32ntdll.dll 10 kernel32.dll BaseCopyStream + 0x11a9 0x77034b89 C:WindowsSystem32kernel32.dll 11 kernel32.dll BasepCopyFileExW + 0x545 0x77033d85 C:WindowsSystem32kernel32.dll 12 kernel32.dll PrivCopyFileExW + 0xb6 0x770b5296 C:WindowsSystem32kernel32.dll 13 Robocopy.exe CZDir::CopyData + 0xb5 0xff8623a9 C:WindowsSystem32Robocopy.exe 14 Robocopy.exe RoboCopyDir + 0xe4 0xff85af00 C:WindowsSystem32Robocopy.exe 15 Robocopy.exe Walk + 0x12a 0xff85c6b6 C:WindowsSystem32Robocopy.exe 16 Robocopy.exe wmain + 0x4f4 0xff85de78 C:WindowsSystem32Robocopy.exe 17 Robocopy.exe operator+ + 0x19b 0xff867be5 C:WindowsSystem32Robocopy.exe 18 kernel32.dll BaseThreadInitThunk + 0xd 0x7703f33d C:WindowsSystem32kernel32.dll 19 ntdll.dll RtlUserThreadStart + 0x1d 0x77172ca1 C:WindowsSystem32ntdll.dll 另一个robocopy想检查文件是否已经存在并调用FindFirstFile,这导致打开目录以及完全共享. Date & Time: 20.03.2012 08:30:06 Event Class: File System Operation: CreateFile Result: SHARING VIOLATION Path: C:tempdest TID: 8280 Duration: 0.0000099 Desired Access: Read Data/List Directory,Synchronize Disposition: Open Options: Directory,Synchronous IO Non-Alert Attributes: n/a ShareMode: Read,Write,Delete <----- Full sharing AllocationSize: n/a 0 fltmgr.sys FltpPerformPreCallbacks + 0x2f7 0xfffff88001045027 C:Windowssystem32driversfltmgr.sys 1 fltmgr.sys FltpPassThroughInternal + 0x4a 0xfffff880010478ca C:Windowssystem32driversfltmgr.sys 2 fltmgr.sys FltpCreate + 0x293 0xfffff880010652a3 C:Windowssystem32driversfltmgr.sys 3 ntoskrnl.exe IopParseDevice + 0x5a7 0xfffff800031cb537 C:Windowssystem32ntoskrnl.exe 4 ntoskrnl.exe ObpLookupObjectName + 0x585 0xfffff800031c1ba4 C:Windowssystem32ntoskrnl.exe 5 ntoskrnl.exe ObOpenObjectByName + 0x1cd 0xfffff800031c6b7d C:Windowssystem32ntoskrnl.exe 6 ntoskrnl.exe IopCreateFile + 0x2b7 0xfffff800031cd647 C:Windowssystem32ntoskrnl.exe 7 ntoskrnl.exe NtOpenFile + 0x58 0xfffff800031e64a8 C:Windowssystem32ntoskrnl.exe 8 ntoskrnl.exe KiSystemServiceCopyEnd + 0x13 0xfffff80002eca813 C:Windowssystem32ntoskrnl.exe 9 ntdll.dll NtOpenFile + 0xa 0x7718f9ea C:WindowsSystem32ntdll.dll 10 KernelBase.dll FindFirstFileExW + 0x1ee 0x7fefd3a560e C:WindowsSystem32KernelBase.dll 11 KernelBase.dll FindFirstFileW + 0x1c 0x7fefd3a58dc C:WindowsSystem32KernelBase.dll 12 Robocopy.exe CZDir::Exists + 0xf7 0xff861bb7 C:WindowsSystem32Robocopy.exe 13 Robocopy.exe RoboCopyDir + 0x58 0xff85ae74 C:WindowsSystem32Robocopy.exe 14 Robocopy.exe Walk + 0x12a 0xff85c6b6 C:WindowsSystem32Robocopy.exe 15 Robocopy.exe wmain + 0x4f4 0xff85de78 C:WindowsSystem32Robocopy.exe 16 Robocopy.exe operator+ + 0x19b 0xff867be5 C:WindowsSystem32Robocopy.exe 17 kernel32.dll BaseThreadInitThunk + 0xd 0x7703f33d C:WindowsSystem32kernel32.dll 18 ntdll.dll RtlUserThreadStart + 0x1d 0x77172ca1 C:WindowsSystem32ntdll.dll 我也可以在Windows 7上轻松地重现这一点.您只需将两个并行robocopy调用中的只读文件复制到循环中的同一目录中,并等到它发生(大约30秒). for /L %i in (1,1,1000) do robocopy /E /XO /COPY:DAT /A-:R C:ReadOnlySource1 c:tempdest for /L %i in (1,1000) do robocopy /E /XO /COPY:DAT /A-:R C:ReadOnlySource2 c:tempdest 您只能将一个只读文件放入源目录中以获得快速复制和许多并发目录访问.这是Windows的一个已知限制,在文件复制到目录时不允许访问目录吗? 我没有受过教育的意见是,这是一个错误,当您希望以可靠的方式并发访问文件时,它会变得非常糟糕. 解决方法
看起来我们终于从这个问题得到了MS的修复.他们发现并理解了这个问题.但这需要一些时间才能正式准备.目前它仅适用于Windows 7.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- Windows上的Python和vim?
- windows-phone-7 – 如何传递按钮中的参数并在后面的代码中
- 如何在Windows Azure上重置VM上的管理员密码?
- ms-access – 从Microsoft Access导出代码
- Windows应用程序实时监控远程服务器的Linux服务器负载等?
- windows – 使用自定义STS从访问控制服务注销
- windows-server-2003 – 仅适用于特定用户的终端服务管理员
- WinDbg仍然与Windows XP兼容吗?
- electron 读取注册表,以调用Photoshop为例
- windows-phone-7 – 如何从代码隐藏中访问ViewModelLocator
- 触摸屏模拟器:是否有任何Windows模拟器来测试触
- 如何从cmd(Windows)打开chrome中的链接而不将chr
- windows-server-2008 – Excel文件始终以只读模式
- Wix自定义动作DLL依赖于执行时安装的文件
- windows-phone-8 – 获取Windows Phone 8资源密集
- 如何识别这个神秘的Windows服务
- Windows CMD:列出dir和subdir中没有给定扩展名的
- windows – 将文件复制到不可执行的文件夹中?
- 如何在Windows网络上为我的Ubuntu计算机提供域名
- windows-server-2008 – Vertex 2 SSD一次冻结60