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.

Author davin
Recipients BreamoreBoy, amyodov, asksol, davin, jnoller
Date 2015-02-17.22:12:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1424211165.94.0.757777886195.issue9099@psf.upfronthosting.co.za>
In-reply-to
Content
Though the code may have changed a bit in the meantime (Issue11750 in particular), the calls to _winapi.SetNamedPipeHandleState in Lib/multiprocessing/connection.py are still present and largely the same as when this issue was first opened.

The implementation of _winapi.SetNamedPipeHandleState still has the potential to raise a WindowsError with its message (i.e. e.args[0]) set to whatever the Windows GetLastError() function returns.  My reading of the MSDN docs and the code in Modules/_winapi.c is as follows:
1. A WindowsError exception is raised only if the Windows function SetNamedPipeHandleState returns 0.
2. The Windows function SetNamedPipeHandleState only returns 0 if it failed.
3. When that function fails, the Windows function GetLastError is expected to return a non-zero value to provide insight on the nature of the failure.
4. MSDN docs suggest that some functions may call SetLastError with 0 to indicate success (seen when subsequently calling GetLastError).  This creates a bit of a conundrum given what the OP observed in the provided traceback:  the Windows function SetNamedPipeHandleState failed yet the call to GetLastError returned a 0.

Possibly the MSDN docs are incomplete on this specific matter and/or there could be other environmental factors on the system(s) where this issue has been observed not to mention other wrinkles from the OP's reported use of Cython to embed the Python interpreter to trigger the issue.  A google search for other situations triggering this same behavior did turn up mentions of encountering it inside the Wine environment running on Ubuntu -- debugging Wine's re-implementation of Windows APIs is certainly out-of-scope here.  It is possible that this issue is caused by environmental issues and may not be possible to provoke in a supported standard Windows system environment.  Without a test case or some other way to provoke or reproduce the issue, there is little capability to pursue this further.

The OP kindly followed up several years ago to say that he could not find a way to reproduce the issue reliably.  Given that, the above review of the code, and the search results from looking for other instances of this sort of issue, I am going ahead with closing this issue.
History
Date User Action Args
2015-02-17 22:12:46davinsetrecipients: + davin, jnoller, asksol, amyodov, BreamoreBoy
2015-02-17 22:12:45davinsetmessageid: <1424211165.94.0.757777886195.issue9099@psf.upfronthosting.co.za>
2015-02-17 22:12:45davinlinkissue9099 messages
2015-02-17 22:12:45davincreate