[pypy-dev] PyPy 1.6 not working on Windows XP
Alex Pyattaev
alex.pyattaev at gmail.com
Thu Oct 6 00:02:10 CEST 2011
I've had a very similar stuff, as in something crashing only when run many
times when I had a bug in a container type implemented in C. Basically, I had
wrong refcount for the objets, which caused them to be freed by garbage
collectore while they have been still used. Maybe something similar happens in
the code that wraps windows API that handles file opening. That would explain
why the bug never happens on linux. A good candidate would be incorrect
refcount for the return value if the file does not exist. Try something like
this:
s="some_file"
rets=[]
for i in range(1000):
rets.append(os.stat(s))
gc.collect()
#Do something that uses lots of RAM (but a random amount, preferably in
small blocks)
print rets
if it crashes then you have exactly that issue. 1000 might be not enough to
toggle the crash though, as you need the OS to actually allocate different
segments of memory for this to work. The more RAM you have the more cycles you
need to toggle the crash. At least this approach helped me to debug extension
modules written in C.
BTW, for me on VM the test case does not crash. But I have SP2 windows there.
On Wednesday 05 October 2011 19:37:07 Ram Rachum wrote:
> On Wed, Oct 5, 2011 at 6:51 PM, Amaury Forgeot d'Arc
<amauryfa at gmail.com>wrote:
> > 2011/10/5 Ram Rachum <ram at rachum.com>:
> > > Okay, I've spent a few hours print-debugging, and I think I've
> > > almost got it.
> > >
> > > The crash happens on a line:
> > > st = os.stat(s)
> > >
> > > inside `os.path.isdir`, where `s` is a string 'C:\\Documents and
> > > Settings\\User\\My Documents\\Python
> > > Projects\\GarlicSim\\garlicsim\\src' This is a directory that
> > > happens not to exist, but of course this is not>
> > a
> >
> > > good reason to crash.
> > > I have tried running `os.stat(s)` in the PyPy shell with that same
> > > `s`,
> >
> > but
> >
> > > didn't get a crash there. I don't know why it's crashing in Nose but
> > > not>
> > in
> >
> > > the shell.
> > >
> > > Does anyone have a clue?
> >
> > it's possible that it's a RPython-level exception, or a bad handle
> > because too many files wait for the garbage collector to close them.
> >
> > Can you give more information about the crash itself?
> > - What are the last lines printed in the console? Try to disable
> > "stdout capture" in Nose, by passing the -s option.
>
> This is the entire output:
>
> Preparing to run tests using Python 2.7.1 (080f42d5c4b4, Aug 23 2011,
> 11:41:11)
> [PyPy 1.6.0 with MSC v.1500 32 bit]
> Running tests directly from GarlicSim repo.
> Pypy doesn't have wxPython, not loading `garlicsim_wx` tests.
> nose.config: INFO: Set working dir to C:\Documents and Settings\User\My
> Documents\Python Projects\GarlicSim
> nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
> nose.plugins.cover: INFO: Coverage report will include only packages:
> ['garlicsim', 'garlicsim_lib', 'garlicsim_wx', 'test_garlicsim',
> 'test_garlicsim_lib', 'test_garlicsim_wx', 'garlicsim', 'garlicsim_lib',
> 'garlicsim_wx', 'test_garlicsim', 'test_garlicsim_lib', 'test_garlicsim_wx',
> 'garlicsim', 'garlicsim_lib', 'garlicsim_wx', 'test_garlicsim',
> 'test_garlicsim_lib', 'test_garlicsim_wx']
>
>
>
>
> - after the pypy process has exited, type "echo %ERRORLEVEL%" in the
>
> > same console, to print the exit code
> > of the last process. Which number is it?
>
> -1073741819
>
> > --
> > Amaury Forgeot d'Arc
More information about the pypy-dev
mailing list