This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Always run kill_python(_d).exe when (re-)building on Windows
Type: enhancement Stage: resolved
Components: Build, Windows Versions: Python 3.3, Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zach.ware Nosy List: brian.curtin, python-dev, tim.golden, tim.peters, zach.ware
Priority: normal Keywords: patch

Created on 2013-11-26 04:45 by zach.ware, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
kill_python_prebuild.diff zach.ware, 2013-11-26 04:45 review
Messages (6)
msg204448 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-11-26 04:45
The attached patch turns running kill_python(_d).exe into a PreBuildEvent in pythoncore.vcxproj.  This should guarantee that kill_python(_d).exe is always run to guarantee no zombie pythons in the background can prevent overwriting the Python dll.  The pythoncore project already depends on the kill_python project, so kill_python should always be built and ready before this PreBuildEvent fires.  The patch also removes the separate building and running of kill_python_d.exe from the buildbot build scripts, since it should be unnecessary with the patch to pythoncore.vcxproj.

Tim Peters, this patch was partly inspired by your issues in #19779; I suspect that perhaps your rebuild didn't take due to the segfaulted interpreter still hanging around in the background since the same thing happened to me doing a rebuild from the command line.  Would you mind testing this patch to see if it would have helped in your case?  Steps to test should be something like:

- update to e39db21df580
- build, run test_concurrent_futures (expect segfault)
- update to default
- rebuild, run test_concurrent_futures (expect build error and segfault again)
- apply patch
- rebuild, run test_concurrent_futures (expect success (or usual result))
msg204449 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2013-11-26 05:00
Zach, I'll try the patch soon.  Will this kill _all_ Python processes?  I often have some unrelated Python program(s) running when waiting for a development build to finish, so that could create real havoc.

BTW, I'm sure you're right that zombie Pythons were the cause of my earlier woes.
msg204450 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2013-11-26 05:06
OK, looked at the code and sees that it tries to kill only pythons created by the build process - I feel batter now :-)
msg204452 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2013-11-26 05:29
Done.  I wasn't able to provoke the failing test into leaving behind rogue processes, so I eventually just ran some python_d processes of my own.  Of course that stopped the build from replacing the executables, so test_concurrent_futures kept failing.

But after applying your patch, my python_d processes were indeed killed off, as expected, and test_concurrent_futures started working again.

So:  ship it! :-)  Thanks!
msg204542 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-11-26 22:35
New changeset ca600150205a by Zachary Ware in branch '3.3':
Issue #19788: kill_python(_d).exe is now run as a PreBuildEvent on the

New changeset 2c1e041cb504 by Zachary Ware in branch 'default':
Issue #19788: kill_python(_d).exe is now run as a PreBuildEvent on the
msg204543 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2013-11-26 22:35
Thanks for the test, Tim :)
Date User Action Args
2022-04-11 14:57:54adminsetgithub: 63987
2013-11-26 22:35:47zach.waresetstatus: open -> closed
messages: + msg204543

assignee: zach.ware
resolution: fixed
stage: patch review -> resolved
2013-11-26 22:35:02python-devsetnosy: + python-dev
messages: + msg204542
2013-11-26 05:29:59tim.peterssetmessages: + msg204452
2013-11-26 05:06:36tim.peterssetmessages: + msg204450
2013-11-26 05:00:36tim.peterssetmessages: + msg204449
2013-11-26 04:45:31zach.warecreate