Robert Smallshire
2006-10-26 17:15:24 UTC
Hi,
I'm building a large system in parallel with SCons on a multiprocessor
(4 core) Windows Server 2003 64-bit edition server. I'm getting frequent
build failures owing to what I suspect to be a race condition in the
SCons scheduler when building in parallel. The failure is always related
to one of my own custom builders, which uses a simple Python function to
generate some C++ code.
My action function which does the code generation opens a file, writes
C++ code to the file, and explicitly closes the file, using the standard
Python try: finally: idiom to ensure that the file is closed before the
function returns.
However, SCons seems to be attempting to compile the resulting C++ file,
before my build action has closed the file. Of course, the compiler
fails to open the file, and the build fails.
Forcing a garbage collection sweep with gc.collect() immediately after
closing the file seems to help, but this is probably because it stops
all Python threads, and effectively serialises the build actions.
Here is some sample build output:
rmsInitializerAction(["D:\build\robertsm\products\rms\8_0s\windows-amd64
-vc_8_0-normal\reditor\ui\reditor_ui__initializer.cpp"],
["'reditor_ui__initializer.cpp'", "''", "''"])
cl /nologo /EHsc /Zc:forScope /GR /W0 /MD /Od /TP /DWIN64 /D__WIN32__
/D_CRT_SECURE_NO_DEPRECATE /D_HAS_ITERATOR_DEBUGGING=0 /D_SECURE_SCL=0
/DWINDOWS /DLITTLEENDIAN /DQT /DQT_DLL /DQT_THREAD_SUPPORT /DNO_DEBUG=1
/DQT_NO_CHECK=1 /DQT_NO_DEBUG=1 /I.
/ID:\p4workspaces\robertsm\packages\windows-amd64-vc_8_0-release\qt-3_3_
5\include
/ID:\p4workspaces\robertsm\packages\windows-amd64-vc_8_0-release\qt-3_3_
5\mkspecs\win32-msvc.net
/ID:\p4workspaces\robertsm\packages\windows-amd64-vc_8_0-release\oiv-5_0
_4\include /c
D:\build\robertsm\products\rms\8_0s\windows-amd64-vc_8_0-normal\reditor\
ui\reditor_ui__initializer.cpp
/FoD:\build\robertsm\products\rms\8_0s\windows-amd64-vc_8_0-normal\redit
or\ui\reditor_ui__initializer.obj
reditor_ui__initializer.cpp
c1xx : fatal error C1083: Cannot open source file:
'D:\build\robertsm\products\rms\8_0s\windows-amd64-vc_8_0-normal\reditor
\ui\reditor_ui__initializer.cpp': Permission denied
scons: ***
[D:\build\robertsm\products\rms\8_0s\windows-amd64-vc_8_0-normal\reditor
\ui\reditor_ui__initializer.obj] Error 2
Unfortunately, I've failed to distill this down to a simple example, as
is the norm with threading problems - but I strongly suspect there is a
problem with the SCons scheduler with parallel builds.
Other details: SCons v0.96.92.D002. Python 2.5 AMD64 build.
Has anybody seen anything similar, or created a fix for this?
Rob Smallshire
DISCLAIMER:
This message contains information that may be privileged or confidential and is the property of the Roxar Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
I'm building a large system in parallel with SCons on a multiprocessor
(4 core) Windows Server 2003 64-bit edition server. I'm getting frequent
build failures owing to what I suspect to be a race condition in the
SCons scheduler when building in parallel. The failure is always related
to one of my own custom builders, which uses a simple Python function to
generate some C++ code.
My action function which does the code generation opens a file, writes
C++ code to the file, and explicitly closes the file, using the standard
Python try: finally: idiom to ensure that the file is closed before the
function returns.
However, SCons seems to be attempting to compile the resulting C++ file,
before my build action has closed the file. Of course, the compiler
fails to open the file, and the build fails.
Forcing a garbage collection sweep with gc.collect() immediately after
closing the file seems to help, but this is probably because it stops
all Python threads, and effectively serialises the build actions.
Here is some sample build output:
rmsInitializerAction(["D:\build\robertsm\products\rms\8_0s\windows-amd64
-vc_8_0-normal\reditor\ui\reditor_ui__initializer.cpp"],
["'reditor_ui__initializer.cpp'", "''", "''"])
cl /nologo /EHsc /Zc:forScope /GR /W0 /MD /Od /TP /DWIN64 /D__WIN32__
/D_CRT_SECURE_NO_DEPRECATE /D_HAS_ITERATOR_DEBUGGING=0 /D_SECURE_SCL=0
/DWINDOWS /DLITTLEENDIAN /DQT /DQT_DLL /DQT_THREAD_SUPPORT /DNO_DEBUG=1
/DQT_NO_CHECK=1 /DQT_NO_DEBUG=1 /I.
/ID:\p4workspaces\robertsm\packages\windows-amd64-vc_8_0-release\qt-3_3_
5\include
/ID:\p4workspaces\robertsm\packages\windows-amd64-vc_8_0-release\qt-3_3_
5\mkspecs\win32-msvc.net
/ID:\p4workspaces\robertsm\packages\windows-amd64-vc_8_0-release\oiv-5_0
_4\include /c
D:\build\robertsm\products\rms\8_0s\windows-amd64-vc_8_0-normal\reditor\
ui\reditor_ui__initializer.cpp
/FoD:\build\robertsm\products\rms\8_0s\windows-amd64-vc_8_0-normal\redit
or\ui\reditor_ui__initializer.obj
reditor_ui__initializer.cpp
c1xx : fatal error C1083: Cannot open source file:
'D:\build\robertsm\products\rms\8_0s\windows-amd64-vc_8_0-normal\reditor
\ui\reditor_ui__initializer.cpp': Permission denied
scons: ***
[D:\build\robertsm\products\rms\8_0s\windows-amd64-vc_8_0-normal\reditor
\ui\reditor_ui__initializer.obj] Error 2
Unfortunately, I've failed to distill this down to a simple example, as
is the norm with threading problems - but I strongly suspect there is a
problem with the SCons scheduler with parallel builds.
Other details: SCons v0.96.92.D002. Python 2.5 AMD64 build.
Has anybody seen anything similar, or created a fix for this?
Rob Smallshire
DISCLAIMER:
This message contains information that may be privileged or confidential and is the property of the Roxar Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorised to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.