[issue20414] Python 3.4 has two Overlapped types

STINNER Victor report at bugs.python.org
Wed Feb 12 00:54:36 CET 2014


STINNER Victor added the comment:

> Victor, you really shouldn't submit code that you don't understand.

In fact I do understand overlapped_dealloc.patch, it's "quite simple". On Windows XP, if you have exit Python with pending overlapped operations, you must not release the read or write buffer of the operation, or the process may crash because Windows tries to read from or write into freed memory. The trick is to not release the read/write buffer (but close the Windows handle of the overlapped operation) if the operation is pending and python is exiting.

On more recent version, you can safetly cancel a pending operations, so the issue is specific to Windows XP (and older, but we don't support Windows 2000 anymore, right?).

Martin: I didn't understand your suggestion on Rietveld:
"Why is this the default case? I think it should be the ERROR_IO_INCOMPLETE case, because only this error handled. Any other error should IMO be raised as is, and the resources still be released."

I wrote a patch just to ask you if it is the change you suggested, and you still didn't answer to this question ("is overlapped_dealloc-2.patch what you wanted?")

I'm not sure that it is safe to release the memory if the state is different than ERROR_IO_INCOMPLETE. Well, it is safer to never release memory at exit, but it may leeak memory. So maybe Martin's suggestion can be delayed after Python 3.4 (to give more time to buildbots to test it), but Richard's fix (overlapped_dealloc.patch) can be applied (on _overlapped) to Python 3.4?

--

Sorry for mixing two different issues in the same issue, in fact  overlapped_dealloc.patch is just the follow up of #19565 for the _overlapped module. I didn't expect so long discussions for such patch :-(

----------
versions:  -Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20414>
_______________________________________


More information about the Python-bugs-list mailing list