Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue15526] test_startfile crash on Windows 7 AMD64

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Aug 18, 2012, 3:53 PM

Post #1 of 7 (117 views)
Permalink
[issue15526] test_startfile crash on Windows 7 AMD64

Antoine Pitrou added the comment:

It crashed again, despite issue15496 being fixed:
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/496

----------
title: regrtest crash on Windows 7 AMD64 -> test_startfile crash on Windows 7 AMD64

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15526>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 18, 2012, 5:29 PM

Post #2 of 7 (112 views)
Permalink
[issue15526] test_startfile crash on Windows 7 AMD64 [In reply to]

Jeremy Kloth added the comment:

Unfortunately, this is a legitimate failure of the test. The test
(actually the support code) is attempting to remove a directory that
is the current directory of an active process. The test has
documented this issue and attempted to work around it by adding a
sleep().

To fix this test there a few options:
1) increase the sleep timeout
2) change the current working directory before calling os.startfile()
(possible that of the Python interpreter itself)
3) code a "wait for child process" function using ctypes and the
Toolhelp API (Process32First/Next)
4) change os.startfile() to use ShellExecuteEx and use the hProcess
handle as the return value and use that with os.waitpid()

#4 is the most accurate, but does introduce an API change (the
introduction of a return value to os.startfile)
#3 is more work but may be helpful for other tests
#2 will definitely work in this case but does violate the testing sandbox
#1 is the least disruptive, but is really just avoiding the root cause

I would like to see #4 but realize that it may be too late for 3.3.
#3 is not bad either as it has impact only on the test suite. But any
of the above should fix this particular case.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15526>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 19, 2012, 3:31 AM

Post #3 of 7 (111 views)
Permalink
[issue15526] test_startfile crash on Windows 7 AMD64 [In reply to]

Richard Oudkerk added the comment:

I think the reason that it is only this buildbot which fails is that the other Windows buildbots don't use multiple processes. Therefore they don't use a different dir for each test.

> 4) change os.startfile() to use ShellExecuteEx and use the hProcess
> handle as the return value and use that with os.waitpid()

Would this cause a handle leak if os.waitpid() is not used?

----------
nosy: +sbt

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15526>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 19, 2012, 7:32 AM

Post #4 of 7 (111 views)
Permalink
[issue15526] test_startfile crash on Windows 7 AMD64 [In reply to]

Jeremy Kloth added the comment:

> I think the reason that it is only this buildbot which fails is that the other Windows buildbots don't use multiple processes. Therefore they don't use a different dir for each test.

That might be it. Also the failure possibly only happens when
multiple builds are being run thus slowing down process creation and
termination.

> Would this cause a handle leak if os.waitpid() is not used?

It seems so, yes.

So to expand on #4:
4a) create a new handle type that closes the handles on dealloc
4b) return the process ID instead using GetProcessId() and callers
interested in waiting would then need to use _winapi.OpenProcess() to
convert it to a handle for os.waitpid() or
_winapi.WaitForSingleObject()
4c) add a third optional argument to os.startfile() "mode" that mimics
the mode semantics of the os.spawn*() functions

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15526>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 19, 2012, 7:43 AM

Post #5 of 7 (111 views)
Permalink
[issue15526] test_startfile crash on Windows 7 AMD64 [In reply to]

Antoine Pitrou added the comment:

I think the two "simple and stupid" solutions (#1 and #2) have a certain charm myself :) Especially #1, which is the simplest of all.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15526>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 19, 2012, 8:26 AM

Post #6 of 7 (108 views)
Permalink
[issue15526] test_startfile crash on Windows 7 AMD64 [In reply to]

Jeremy Kloth added the comment:

However #1 is the reason that is bug exists in the first place. The
designer of the test guessed wrong on the "magic value" for the
timeout. There will never be a correct timeout value as it varies
from machine to machine and from workload to workload on a given
machine. For any value that is picked, there exists a scenario where
it will fail.

#2 is certainly a viable work-around and it appears that other tests
(notably the test for fork/exec) do similar so it wouldn't be
unprecedented

#3 is really only useful if other tests need a "wait for process"
helper on Windows.

#4 really just highlights a deficiency with os.startfile() so I'm fine
with deferring that to a feature request for 3.4.

I'll cook up a patch implementing #2 unless anyone else is feeling ambitious.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15526>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Aug 21, 2012, 6:22 AM

Post #7 of 7 (102 views)
Permalink
[issue15526] test_startfile crash on Windows 7 AMD64 [In reply to]

Jeremy Kloth added the comment:

Here is the patch implementing option #2

----------
keywords: +patch
nosy: +jkloth
Added file: http://bugs.python.org/file26947/test_startfile.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue15526>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.