python / cpython

The Python programming language
https://www.python.org
Other
63.87k stars 30.57k forks source link

Crash on deep call stack under Windows #89069

Open 427393de-8454-476a-9416-afaff209c1ea opened 3 years ago

427393de-8454-476a-9416-afaff209c1ea commented 3 years ago
BPO 44906
Nosy @pfmoore, @tjguk, @zware, @zooba, @aleReimondo
Files
  • crashWin3.9-2021-08-12.zip: snapshot and test file
  • 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: ```python assignee = None closed_at = None created_at = labels = ['interpreter-core', 'OS-windows', 'type-crash', '3.9'] title = 'Crash on deep call stack under Windows' updated_at = user = 'https://github.com/aleReimondo' ``` bugs.python.org fields: ```python activity = actor = 'steve.dower' assignee = 'none' closed = False closed_date = None closer = None components = ['Interpreter Core', 'Windows'] creation = creator = 'aleReimondo' dependencies = [] files = ['50214'] hgrepos = [] issue_num = 44906 keywords = [] message_count = 3.0 messages = ['399487', '399563', '399565'] nosy_count = 5.0 nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'steve.dower', 'aleReimondo'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'open' superseder = None type = 'crash' url = 'https://bugs.python.org/issue44906' versions = ['Python 3.9'] ```

    427393de-8454-476a-9416-afaff209c1ea commented 3 years ago

    The py8.py file starts a S8 system, a Smalltalk system running on Python runtime, I am actually developing (in Beta). The system is running w/o problems on OSX systems, but crash (fast exit w/o any information) when running on Windows. The crash occurs while compiling a simple expression (simple but produce a deep recursion on parsing stage). The expression is shown in "fileMeIn.st". The issue happens on Windows and python version Python 3.9.2 The stack depth is aprox 1800 frames. Steps to reproduce the crash: 1.- decompress the zip file in a folder 2.- on command prompt "python -i py8.py" 3.- "Image loaded" must be shown in console 4.- evaluate "t()" to run tests that fileIn the code in "fileMeIn.st" 5.- after aprox. one minute working, the fast exit occurs and the Python VM exits without reporting anything on output

    zooba commented 3 years ago

    I guess we've got a new path through the interpreter loop that takes more stack space than before and isn't part of our existing recursion tests.

    It's probably somewhere in the vector call changes. Capturing the stack at overflow point should show us - I'll see if I can get it easily from the repro.

    zooba commented 3 years ago

    I get stack overflows all the way back to 3.7, so it's probably not anything new. But our stack overflow detection is clearly not going to catch this case. It's really only set up for a direct call within Python code, but this is going through many more steps.

    Best thing you can do as a user is run it with "python -X faulthandler ..." to see the error. Perhaps we can handle the stack overflow ourselves and print a message suggesting that option, but unfortunately this problem doesn't have a generic solution :( The assumption is that you have a known recursion limit for your application, and as a scripting engine, we don't. Decoupling from the C stack is the best hope.