classification
Title: multiprocessing segmentfault under Windows compatibility mode
Type: crash Stage:
Components: Windows Versions: Python 3.8, Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Ma Lin, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords:

Created on 2018-02-11 04:27 by Ma Lin, last changed 2018-02-13 08:22 by Ma Lin.

Messages (4)
msg311980 - (view) Author: Ma Lin (Ma Lin) * Date: 2018-02-11 04:27
Reproduce:
Right click python.exe -> properties -> compatibility tab -> enable compatibility mode (e.g. Windows 7)

Then run this test will get a segmentfault: test_multiprocessing_main_handling.py

CPython 3.6 is Ok.
msg311982 - (view) Author: Ma Lin (Ma Lin) * Date: 2018-02-11 04:54
Here is two traceback messages:

D:\git\cpython\PCbuild\win32>python.exe -X dev d:\git\cpython\Lib\test\test_multiprocess
ing_main_handling.py
ssssssssssssssssssssssssssFFFFFFFFFFFFF
======================================================================
FAIL: test_basic_script (__main__.SpawnCmdLineTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "d:\git\cpython\Lib\test\test_multiprocessing_main_handling.py", line 162, in test_basic_script
    self._check_script(script_name)
  File "d:\git\cpython\Lib\test\test_multiprocessing_main_handling.py", line 156, in _check_script
    rc, out, err = assert_python_ok(*run_args, __isolated=False)
  File "D:\git\cpython\lib\test\support\script_helper.py", line 151, in assert_python_ok

    return _assert_python(True, *args, **env_vars)
  File "D:\git\cpython\lib\test\support\script_helper.py", line 137, in _assert_python
    res.fail(cmd_line)
  File "D:\git\cpython\lib\test\support\script_helper.py", line 79, in fail
    err))
AssertionError: Process return code is 3221225477
command line: ['D:\\git\\cpython\\PCbuild\\win32\\python.exe', '-X', 'faulthandler', '-E
', 'C:\\Users\\anima\\AppData\\Local\\Temp\\tmplgfds7rc\\script.py', 'spawn']

stdout:
---

---

stderr:
---
Windows fatal exception: access violation

Current thread 0x00001930 (most recent call first):
  File "D:\git\cpython\lib\multiprocessing\popen_spawn_win32.py", line 48 in __init__
  File "D:\git\cpython\lib\multiprocessing\context.py", line 322 in _Popen
  File "D:\git\cpython\lib\multiprocessing\process.py", line 112 in start
  File "D:\git\cpython\lib\multiprocessing\pool.py", line 241 in _repopulate_pool
  File "D:\git\cpython\lib\multiprocessing\pool.py", line 176 in __init__
  File "D:\git\cpython\lib\multiprocessing\context.py", line 119 in Pool
  File "C:\Users\anima\AppData\Local\Temp\tmplgfds7rc\script.py", line 27 in <module>
---

======================================================================
FAIL: test_basic_script_no_suffix (__main__.SpawnCmdLineTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "d:\git\cpython\Lib\test\test_multiprocessing_main_handling.py", line 168, in test_basic_script_no_suffix
    self._check_script(script_name)
  File "d:\git\cpython\Lib\test\test_multiprocessing_main_handling.py", line 156, in _check_script
    rc, out, err = assert_python_ok(*run_args, __isolated=False)
  File "D:\git\cpython\lib\test\support\script_helper.py", line 151, in assert_python_ok

    return _assert_python(True, *args, **env_vars)
  File "D:\git\cpython\lib\test\support\script_helper.py", line 137, in _assert_python
    res.fail(cmd_line)
  File "D:\git\cpython\lib\test\support\script_helper.py", line 79, in fail
    err))
AssertionError: Process return code is 3221225477
command line: ['D:\\git\\cpython\\PCbuild\\win32\\python.exe', '-X', 'faulthandler', '-E
', 'C:\\Users\\anima\\AppData\\Local\\Temp\\tmpkovn5nfz\\script', 'spawn']

stdout:
---

---

stderr:
---
Windows fatal exception: access violation

Current thread 0x00001d00 (most recent call first):
  File "D:\git\cpython\lib\multiprocessing\popen_spawn_win32.py", line 48 in __init__
  File "D:\git\cpython\lib\multiprocessing\context.py", line 322 in _Popen
  File "D:\git\cpython\lib\multiprocessing\process.py", line 112 in start
  File "D:\git\cpython\lib\multiprocessing\pool.py", line 241 in _repopulate_pool
  File "D:\git\cpython\lib\multiprocessing\pool.py", line 176 in __init__
  File "D:\git\cpython\lib\multiprocessing\context.py", line 119 in Pool
  File "C:\Users\anima\AppData\Local\Temp\tmpkovn5nfz\script", line 27 in <module>
---
msg312056 - (view) Author: Ma Lin (Ma Lin) * Date: 2018-02-12 14:35
segmentfault conditions:
64bit Windows + 32bit Python + Compatibility Mode enabled.

some infomation:
1, 64bit Python doesn't segmentfault.
2, 3.7.0a3 is ok, 3.7.0a4 segmentfaults.
3, unrelated to Windows SDK, switch from 1709 SDK to 1703 SDK also segmentfaults.
msg312108 - (view) Author: Ma Lin (Ma Lin) * Date: 2018-02-13 08:22
Git bisect says this is the first bad commit:
https://github.com/python/cpython/commit/b2a6083eb0384f38839d3f1ed32262a3852026fa
History
Date User Action Args
2018-02-13 08:22:54Ma Linsetmessages: + msg312108
2018-02-12 14:35:06Ma Linsetmessages: + msg312056
2018-02-11 04:54:04Ma Linsetmessages: + msg311982
2018-02-11 04:27:54Ma Lincreate