Skip to content

test_multiprocessing_main_handling: subprocess crash under Windows compatibility mode #76999

Closed as not planned

Description

@animalize
mannequin
BPO 32818
Nosy @pfmoore, @tjguk, @zware, @zooba, @animalize, @segevfiner
PRs
  • bpo-32818: Fix a subprocess crash in Windows compatiblity mode #5948
  • Files
  • crash32818.zip
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2018-02-11.04:27:54.025>
    labels = ['3.7', '3.8', 'OS-windows', 'type-crash']
    title = 'subprocess crash under Windows compatibility mode'
    updated_at = <Date 2018-03-02.01:46:24.654>
    user = 'https://github.com/animalize'

    bugs.python.org fields:

    activity = <Date 2018-03-02.01:46:24.654>
    actor = 'malin'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Windows']
    creation = <Date 2018-02-11.04:27:54.025>
    creator = 'malin'
    dependencies = []
    files = ['47465']
    hgrepos = []
    issue_num = 32818
    keywords = ['patch']
    message_count = 6.0
    messages = ['311980', '311982', '312056', '312108', '313055', '313094']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'steve.dower', 'malin', 'Segev Finer']
    pr_nums = ['5948']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue32818'
    versions = ['Python 3.7', 'Python 3.8']

    Activity

    1. animalize commented on Feb 11, 2018

      animalizemannequin
      MannequinAuthor

      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.

    2. added
      3.7 (EOL)
      3.8 (EOL)
      type-crash
      on Feb 11, 2018
    3. animalize commented on Feb 11, 2018

      animalizemannequin
      MannequinAuthor

      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>
      ---

    4. animalize commented on Feb 12, 2018

      animalizemannequin
      MannequinAuthor

      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.

    5. animalize commented on Feb 13, 2018

      animalizemannequin
      MannequinAuthor

      Git bisect says this is the first bad commit:
      b2a6083

    6. animalize commented on Feb 28, 2018

      animalizemannequin
      MannequinAuthor

      3.7.0 beta2 still segmentfault.
      Finer, please have a look.

      segmentfault conditions:
      64bit Windows 10 (1709) + 32bit Python 3.7.0 Beta2 + Compatibility Mode enabled.
      (64bit Python doesn't segmentfault)

    7. segevfiner commented on Mar 1, 2018

      segevfinermannequin
      Mannequin

      Windows seems to dereference lpStartupInfo->lpAttributeList, despite it being NULL since we had no attributes to set. Smells like a Windows bug in the compatibility shim, since it doesn't crash in non compatibility mode.

      Not setting EXTENDED_STARTUPINFO_PRESENT when lpStartupInfo->lpAttributeList is NULL will fix this. Not sure about lpStartupInfo->cb, I think Windows only checks it's large enough.

      Also attached is a crash dump with symbols and used source revision of a reproduction of this.

      Stack Trace:
      00 00fee690 5ad47c1c AcLayers!NS_ElevateCreateProcess::APIHook_CreateProcessW+0x110
      01 00fee740 5ad45f79 python38_d!_winapi_CreateProcess_impl+0x15c [cpython\modules\_winapi.c @ 1046]
      02 00fee798 5ad78e75 python38_d!_winapi_CreateProcess+0x79 [cpython\modules\clinic\_winapi.c.h @ 326]
      03 00fee7f8 5ad77b64 python38_d!_PyMethodDef_RawFastCallKeywords+0x245 [cpython\objects\call.c @ 651]
      04 00fee81c 5aed8f9f python38_d!_PyCFunction_FastCallKeywords+0x84 [cpython\objects\call.c @ 730]
      05 00fee854 5aee038f python38_d!call_function+0x15f [cpython\python\ceval.c @ 4532]
      06 00fee8f4 5ad7b336 python38_d!_PyEval_EvalFrameDefault+0x59bf [cpython\python\ceval.c @ 3128]
      07 00fee92c 5ad77ce4 python38_d!function_code_fastcall+0xe6 [cpython\objects\call.c @ 283]
      08 00fee994 5ad79be7 python38_d!_PyFunction_FastCallDict+0x134 [cpython\objects\call.c @ 322]
      09 00fee9d8 5ad79aa6 python38_d!_PyObject_FastCallDict+0xc7 [cpython\objects\call.c @ 98]
      0a 00feea14 5ae0b8f7 python38_d!_PyObject_Call_Prepend+0xf6 [cpython\objects\call.c @ 904]
      0b 00feea5 5ae10a97 python38_d!slot_tp_init+0x47 [cpython\objects\typeobject.c @ 6597]
      0c 00feea74 5ad7a28e python38_d!type_call+0x187 [cpython\objects\typeobject.c @ 949]
      0d 00feeae0 5aed91d1 python38_d!_PyObject_FastCallKeywords+0x37e [cpython\objects\call.c @ 199]
      0e 00feeb18 5aedc95b python38_d!call_function+0x391 [cpython\python\ceval.c @ 4576]

    8. changed the title [-]multiprocessing segmentfault under Windows compatibility mode[/-] [+]subprocess crash under Windows compatibility mode[/+] on Mar 2, 2018
    9. transferred this issue fromon Apr 10, 2022
    10. added
      tests
      on Jun 6, 2022
    11. changed the title [-]subprocess crash under Windows compatibility mode[/-] [+]test_multiprocessing_main_handling: subprocess crash under Windows compatibility mode[/+] on Jun 6, 2022
    12. kumaraditya303 commented on Jun 19, 2022

      @kumaraditya303
      Contributor

      Closing as windows 7 is not supported anymore nor Windows compatibility mode.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)3.8 (EOL)OS-windowsteststopic-multiprocessingtype-crash

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions