Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator functions stack overflow #79535

Closed
asdwqii mannequin opened this issue Nov 29, 2018 · 6 comments
Closed

Generator functions stack overflow #79535

asdwqii mannequin opened this issue Nov 29, 2018 · 6 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@asdwqii
Copy link
Mannequin

asdwqii mannequin commented Nov 29, 2018

BPO 35354
Nosy @brettcannon, @markshannon, @tirkarthi
Files
  • crash.py
  • 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 = <Date 2019-05-07.14:47:40.022>
    created_at = <Date 2018-11-29.18:40:29.061>
    labels = ['interpreter-core', '3.7', '3.8', 'type-crash']
    title = 'Generator functions stack overflow'
    updated_at = <Date 2019-05-07.14:47:40.019>
    user = 'https://bugs.python.org/asdwqii'

    bugs.python.org fields:

    activity = <Date 2019-05-07.14:47:40.019>
    actor = 'Mark.Shannon'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-05-07.14:47:40.022>
    closer = 'Mark.Shannon'
    components = ['Interpreter Core']
    creation = <Date 2018-11-29.18:40:29.061>
    creator = 'asdwqii'
    dependencies = []
    files = ['47958']
    hgrepos = []
    issue_num = 35354
    keywords = []
    message_count = 6.0
    messages = ['330710', '330712', '330755', '330824', '330840', '341739']
    nosy_count = 3.0
    nosy_names = ['brett.cannon', 'Mark.Shannon', 'xtreak']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue35354'
    versions = ['Python 3.7', 'Python 3.8']

    @asdwqii
    Copy link
    Mannequin Author

    asdwqii mannequin commented Nov 29, 2018

    Gоt Fatal Python error: Cannot recover from stack overflow. on Windows 10, not tested on other os. Crashed when use undefined variable.

    @asdwqii asdwqii mannequin added 3.7 (EOL) end of life interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump labels Nov 29, 2018
    @tirkarthi
    Copy link
    Member

    I think I have seen this bug reported elsewhere but can't find it now.

    A simple reproducer :

    def foo():
        try:
            raise Exception()
        except:
            foo()
    foo()

    Running under gdb on Ubuntu :

    Program received signal SIGABRT, Aborted.
    0x00007ffff7115428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
    54 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.

    @tirkarthi tirkarthi added the 3.8 only security fixes label Nov 29, 2018
    @tirkarthi
    Copy link
    Member

    I think I have seen this bug reported elsewhere but can't find it now.

    Sorry, I was referring to bpo-6028 and bpo-32570 that I thought were similar to the original report.

    @brettcannon
    Copy link
    Member

    How did you make a recursive generator? The 'yield' would have paused execution. Do you have code you can share to reproduce? Otherwise blowing your stack out is normal behaviour in a function which you can deal with by lowering your stack depth with sys.setrecursionlimit() to one that will raise RecursionError before you blow your stack.

    @tirkarthi
    Copy link
    Member

    Brett, the user had an invalid email address in their profile thus adding comments to the issue caused a server error while sending notification to them. So they have been removed from the issue. Please see : https://python.zulipchat.com/#narrow/stream/116501-workflow/subject/Is.20adding.20comment.20in.20bpo.20broken.20for.20anyone.3F/near/148846056

    As for the issue OP attached a reproducer where they produce NameError with the "new" variable which is not defined in the try block and catch the exception to make recursive calls in https://bugs.python.org/file47958/crash.py

    @markshannon
    Copy link
    Member

    I'm closing this as a duplicate of https://bugs.python.org/issue6028

    Making a recursive call in an except block cannot be handled sensibly by the interpreter.

    On exceeding the stack depth, the interpreter will raise a RecursionError.
    Catching a RecursionError and then making a call will blow the stack, leaving the interpreter with no choice; it has to abort.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants