classification
Title: faulthandler does not correctly filter fatal exceptions on Windows
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: steve.dower Nosy List: eryksun, ned.deily, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Priority: normal Keywords:

Created on 2017-06-02 21:09 by steve.dower, last changed 2017-06-06 20:47 by steve.dower. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1924 merged steve.dower, 2017-06-02 21:13
PR 1960 merged steve.dower, 2017-06-05 23:07
PR 1969 merged vstinner, 2017-06-06 15:59
Messages (9)
msg295054 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-06-02 21:09
faulthandler adds a structured exception handler on Windows so we can dump a Python traceback before crashing. This should only be done for fatal exceptions, but is currently done for some non-fatal exceptions.

The current test is `flags & EXCEPTION_NONCONTINUABLE`, which is incorrect (as evidenced by the fact that the check is wrong in its current context and should be `!(flags & EXCEPTION_NONCONTINUABLE)`).

Instead, `code & 0x80000000` determines whether the exception is an error. If not, we should skip logging any info.
msg295055 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-06-02 21:10
Also, it displays exception codes as decimal, but should be hex. I'll fix that too
msg295216 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-06-05 22:54
New changeset e6a23c8f9a3ce05b759599696cc131c2d9d147ac by Steve Dower in branch 'master':
bpo-30557: faulthandler now correctly filters and displays exception codes on Windows (#1924)
https://github.com/python/cpython/commit/e6a23c8f9a3ce05b759599696cc131c2d9d147ac
msg295217 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2017-06-05 23:08
Buildbot failure?
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/521
msg295232 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-06-06 03:07
Thanks. Apparently that "filter out bit 4" thing didn't exist in Win7. Guess I need to track down the actual docs and confirm exactly where that happens.

Doesn't break the important functionality though, just the test. I don't know that the exit code is stable when the process crashes, so perhaps I should just test for non-zero.
msg295272 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-06-06 16:05
It seems like all 3.x Windows buildbots are red... except of x86 Windows7 3.x.

Only on Windows older than 7 SP 1, so on Windows 7 for buildbots, the bit is cleared.

I created https://github.com/python/cpython/pull/1969 to try to fix buildbots.
msg295281 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-06-06 17:40
New changeset 6a1d84e2b37291b7e3bc5ddad14a60aed430e404 by Steve Dower (Victor Stinner) in branch 'master':
bpo-30557: Fix test_faulthandler (#1969)
https://github.com/python/cpython/commit/6a1d84e2b37291b7e3bc5ddad14a60aed430e404
msg295284 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-06-06 17:49
My backport wasn't merged, so I cherrypicked Victor's fix into that PR. Once the buildbots are green again, I'll merge it.
msg295301 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2017-06-06 20:47
New changeset 2bafc0dccac2390a52670ba289878318b6ea0293 by Steve Dower in branch '3.6':
[3.6] bpo-30557: faulthandler now correctly filters and displays exception … (#1960)
https://github.com/python/cpython/commit/2bafc0dccac2390a52670ba289878318b6ea0293
History
Date User Action Args
2017-06-06 20:47:54steve.dowersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-06-06 20:47:16steve.dowersetmessages: + msg295301
2017-06-06 17:49:55steve.dowersetmessages: + msg295284
2017-06-06 17:40:44steve.dowersetmessages: + msg295281
2017-06-06 16:05:20vstinnersetmessages: + msg295272
2017-06-06 15:59:12vstinnersetpull_requests: + pull_request2035
2017-06-06 03:07:05steve.dowersetnosy: + eryksun
messages: + msg295232
2017-06-05 23:08:30ned.deilysetnosy: + ned.deily
messages: + msg295217
2017-06-05 23:07:18steve.dowersetpull_requests: + pull_request2031
2017-06-05 22:54:17steve.dowersetmessages: + msg295216
2017-06-02 21:13:36steve.dowersetpull_requests: + pull_request2004
2017-06-02 21:10:48steve.dowersetmessages: + msg295055
2017-06-02 21:09:30steve.dowercreate