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.

classification
Title: Failed assertions when running test.test_os on Windows
Type: crash Stage: resolved
Components: Tests, Windows Versions: Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: abarry, eryksun, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Priority: normal Keywords: patch

Created on 2016-06-30 16:47 by abarry, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_os failed assertion.png abarry, 2016-06-30 16:47
issue27423_1.patch eryksun, 2016-07-01 03:09 review
Messages (6)
msg269599 - (view) Author: Anilyka Barry (abarry) * (Python triager) Date: 2016-06-30 16:47
Running test_os yields a ton (something like 20) failed assertion warnings. The attached screenshot is one of them (comes up a few times), but there are others. Choosing to Ignore the error makes Python think that the test was merely skipped without any error.

I'm not sure where exactly this kind of bug report goes (doesn't seem to be Python's fault), but I'm hoping some of the Windows experts can pick this up.
msg269640 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2016-07-01 03:09
The attached patch suppresses the failed-assertion message boxes when running test_os on a debug build.
msg269643 - (view) Author: Anilyka Barry (abarry) * (Python triager) Date: 2016-07-01 04:33
I'm not sure about the patch - sure, the messages might go away, but I find it concerning that the assertions are failing to begin with. Of course, it only happens when in debug (and this might be a non-issue in practice, I haven't checked), but shouldn't we fix this in the C code? As I understand it though, that part of code is out of Python's control, so there might not be much we can do...

But I'm probably overthinking everything again ;)
msg269645 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2016-07-01 05:24
test_os intentionally operates on invalid file descriptors. In the Windows CRT this leads to failed assertions, such as from its _VALIDATE_RETURN macro. This macro would also call the default invalid parameter handler, which would kill the process, but that's disabled in 3.5+ via _Py_BEGIN_SUPPRESS_IPH. That leaves the message box for failed assertions in debug builds [1]. On entry, support.SuppressCrashReport calls the CRT functions _CrtSetReportMode [2] and _CrtSetReportFile [3] to ensure that failed assertions are instead printed to stderr. These functions are available in a debug build of the msvcrt module.

[1]: https://msdn.microsoft.com/en-us/library/9sb57dw4.aspx
[2]: https://msdn.microsoft.com/en-us/library/1y71x448.aspx
[3]: https://msdn.microsoft.com/en-us/library/a68f826y.aspx
msg269646 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2016-07-01 05:27
The warnings are expected - Python has to be able to handle arbitrarily bad parameters/use without crashing, while the CRT assumes that bugs belong to the direct caller who needs to fix them. As a result, it will assert and terminate for blatantly incorrect operations.

A while back we discussed suppressing these warnings by default to stop people worrying, while leaving them enabled for the build bots where those analysing the results are more likely to be aware of the intricacies.

Of course, if the assert dialog is actually showing, we have an issue. If it's only the printed warning then it's expected.
msg333664 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-01-15 10:24
This bug has been fixed in test_os or libregrtest, I don't recall, but it's now fixed ;-)
History
Date User Action Args
2022-04-11 14:58:33adminsetgithub: 71610
2019-01-15 10:24:45vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg333664

stage: patch review -> resolved
2016-07-01 05:27:58steve.dowersetmessages: + msg269646
2016-07-01 05:24:36eryksunsetmessages: + msg269645
2016-07-01 04:33:59abarrysetmessages: + msg269643
2016-07-01 04:26:11serhiy.storchakasetnosy: + vstinner
2016-07-01 03:09:10eryksunsetfiles: + issue27423_1.patch

nosy: + eryksun
messages: + msg269640

keywords: + patch
stage: needs patch -> patch review
2016-06-30 16:47:18abarrycreate