Emil Styrke added the comment:
eryksun, thank you for the explanation, the penny finally dropped for me. It's
the *other* child processes that keep the file open, not the parent. Actually
this bug started hitting me after I *stopped* doing exactly what you suggest
(fdopen on the temp file),
eryksun added the comment:
Emil,
Your example child process opens the file with only read sharing, which fails
with a sharing violation if some other process inherits the file handle with
write access. The `with` block only prevents this in a single-threaded
environment. When you spawn 10
Emil Styrke added the comment:
I have experienced this issue with Python 2.7.8 and 2.7.9. It is almost the
same issue as the OP experiences as far as I can tell: spawn some Python
threads that each create a file, flush, fsync, close, then start a subprocess
which uses the file through the
Terry J. Reedy tjre...@udel.edu added the comment:
To be a tracker bug, as opposed to feature request, behavior must disagree with
the manual or doc string, not personal expectation. In any case, OP declined to
test on 2.6 and suggested closing, so I am. This still remains on tracker to be
Changes by Brian Curtin cur...@acm.org:
--
nosy: +brian.curtin
priority: - normal
stage: - test needed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4944
___
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
python2.6 is not so different from python2.5. Which performance concerns
do you have?
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4944
___
Javen Wang jave...@gmail.com added the comment:
I don't have Python2.6 installed. I just have ever read a bench article
comparing the performance between different version of Python, including
2.5, 2.6 and 3.0. That article shows, for the same script, Python2.6 has
longer running time than
Javen Wang jave...@gmail.com added the comment:
I'm using Python2.5 in which close_fds is not available in Windows. And
I cannot use Python2.6 because I need to redirect the stdout and stderr
and there's performance concern.
I have questions on the root cause:
a. why doesn't fopen() has
Javen Wang jave...@gmail.com added the comment:
I did trace the order of file creation and process launch. It shows the
file is indeed created before the process launch.
I did another investigation. I added a new process, cmd.exe /c copy
Makefile NewMakefile, to copy the the Makefile created,
Javen Wang jave...@gmail.com added the comment:
The test code and script which can reproduce the problem has been uploaded.
Added file: http://bugs.python.org/file12808/test_file_flush.py
___
Python tracker rep...@bugs.python.org
Gabriel Genellina gagsl-...@yahoo.com.ar added the comment:
Thanks for adapting the smaller example. I think I figured out what's
the problem.
The error reported by checkfile.c is 0x20 = ERROR_SHARING_VIOLATION
The process cannot access the file because it is being used by
another process.
I
Javen Wang jave...@gmail.com added the comment:
I'm quite certain that the makefile is generated before the make
program is launched in separated process. Follow is the original code
where the makefile is created (line 14) and a task is put in queue (line
19). It's executed in the main thread
Javen Wang jave...@gmail.com added the comment:
gagenellina,
My application is a little bit different from your test code. It won't
wait for the exit of new process and there're file writing operations
during makefile running. I changed the test code to be real
multi-process and tried many file
Javen Wang jave...@gmail.com added the comment:
The created files are on local drive. I saw the problem on the laptop
(XP-SP2), desktop(XP-SP3) and server (Win2003). But there's no such
problem on the Linux and Mac boxes.
I tried to use fopen/fwrite in my extension according to your
suggestion.
Javen Wang jave...@gmail.com added the comment:
There would be more chances to see the problem by doing this:
C:\test\edk2 python.exe C:\test\tools\Source\Python\build\build.py
-n 2 -p IntelFrameworkModulePkg\IntelFrameworkModulePkg.dsc -a IA32 -s
___
Python
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
I really tried, but I can't run your script. first PYTHONPATH must be
set to some value (I tried with tools\Source\Python); Also the tool is
complaining about missing WORKSPACE and EDK_TOOLS_PATH env vars, and a
missing file
Javen Wang jave...@gmail.com added the comment:
I agree multithread programming is kind of difficult and tricky. But I
don't think there's a race condition in _MultiThreadBuildPlatform
method, because I do have only one producer. And the consumer consumes
the product only when it's done (i.e.
New submission from Javen Wang jave...@gmail.com:
I encountered a very strange issue in file flush operation in Windows.
Here's the scenario of my application:
1. The main thread of my application will create makefiles sequentially.
2. Once a makefile is generated, launch a separate
Changes by Gabriel Genellina gagsl-...@yahoo.com.ar:
Added file: http://bugs.python.org/file12738/checkfile.c
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4944
___
Amaury Forgeot d'Arc amaur...@gmail.com added the comment:
python2.5 uses the functions of the fopen() family: fwrite(), fclose().
Does the problem reproduce if you use these functions in your extension
module?
Are your files located on the local hard drive, or on a network storage?
20 matches
Mail list logo