我现在非常喜欢我们的构建脚本:我正在使用
Waf
为了推动我们的构建过程,一切都很好地工作,除了在Windows上,在构建过程中我会遇到间歇性错误。
这些错误基本上都是一个或另一个窗体的“拒绝访问”错误,与我在构建过程中创建的临时文件有关,以使某些工具能够运行并完成它的工作。例如,在运行之前
NSIS
要生成一个可执行的安装程序,我必须将所有必需的文件“准备”到构建目录,然后从中运行命令。有时事情按预期工作,但有时我会收到一个关于我复制的一个文件的错误报告,例如:
File: failed opening file "Platform\\Win32\\lxml-2.2.1-py2.6-win32.egg
我花了一段时间试图找出问题所在,但这确实很困难,因为问题是间歇性的。我最后尝试的是使用
procmon
要监视文件系统访问以尝试跟踪导致访问错误的原因:我知道文件在那里,所以一定是某个文件打开了。我将相关的输出包含在下面,因为我看不出有什么问题:python似乎在nsis想打开文件之前关闭了文件,但是nsis失败了。有人能解释一下吗?这个问题不仅局限于这种情况,而且也适用于其他情况,在这些情况下,我生成子进程来处理我复制到构建目录中的文件…
7:35:15.9704427 PM python.exe 4968 QueryOpen ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg FAST IO DISALLOWED
7:35:15.9707497 PM python.exe 4968 CreateFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
7:35:15.9708634 PM python.exe 4968 QueryBasicInformationFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS CreationTime: 7/25/2009 7:35:11 PM, LastAccessTime: 7/25/2009 7:35:11 PM, LastWriteTime: 7/25/2009 7:35:11 PM, ChangeTime: 7/25/2009 7:35:11 PM, FileAttributes: A
7:35:15.9709271 PM python.exe 4968 CloseFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS
7:35:15.9785180 PM python.exe 4968 CreateFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS Desired Access: Write Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
7:35:15.9786119 PM python.exe 4968 SetBasicInformationFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS CreationTime: 1/1/1601 1:00:00 AM, LastAccessTime: 1/1/1601 1:00:00 AM, LastWriteTime: 1/1/1601 1:00:00 AM, ChangeTime: 1/1/1601 1:00:00 AM, FileAttributes: AN
7:35:15.9787155 PM python.exe 4968 CloseFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS
7:35:15.9789401 PM python.exe 4968 QueryOpen ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg FAST IO DISALLOWED
7:35:15.9790309 PM python.exe 4968 CreateFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
7:35:15.9790700 PM python.exe 4968 QueryBasicInformationFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS CreationTime: 7/25/2009 7:35:11 PM, LastAccessTime: 7/25/2009 7:35:11 PM, LastWriteTime: 7/25/2009 7:35:11 PM, ChangeTime: 7/25/2009 7:35:12 PM, FileAttributes: A
7:35:15.9790952 PM python.exe 4968 CloseFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS
7:35:15.9792809 PM python.exe 4968 CreateFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS Desired Access: Write Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
7:35:15.9793270 PM python.exe 4968 SetBasicInformationFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS CreationTime: 1/1/1601 1:00:00 AM, LastAccessTime: 1/1/1601 1:00:00 AM, LastWriteTime: 1/1/1601 1:00:00 AM, ChangeTime: 1/1/1601 1:00:00 AM, FileAttributes: AN
7:35:15.9794041 PM python.exe 4968 CloseFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS
7:35:16.3508170 PM makensis.exe 3296 CreateFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SHARING VIOLATION Desired Access: Generic Read, Disposition: Open, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, AllocationSize: n/a
7:35:16.3557763 PM python.exe 4968 QueryOpen ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg FAST IO DISALLOWED
7:35:16.3558928 PM python.exe 4968 CreateFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
7:35:16.3559461 PM python.exe 4968 QueryNetworkOpenInformationFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS CreationTime: 7/25/2009 7:35:11 PM, LastAccessTime: 7/25/2009 7:35:11 PM, LastWriteTime: 7/25/2009 7:35:11 PM, ChangeTime: 7/25/2009 7:35:12 PM, AllocationSize: 1/1/1601 1:00:00 AM, EndOfFile: 1/1/1601 1:00:00 AM, FileAttributes: A
7:35:16.3560121 PM python.exe 4968 CloseFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS
7:35:16.3562048 PM python.exe 4968 CreateFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SHARING VIOLATION Desired Access: Read Attributes, Delete, Disposition: Open, Options: Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
7:35:21.9320579 PM python.exe 3160 CloseFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS