[New-bugs-announce] [issue41912] Long generator chain causes segmentation fault

Tom Karzes report at bugs.python.org
Fri Oct 2 14:01:25 EDT 2020


New submission from Tom Karzes <karzes at sonic.net>:

If I create a sufficiently long chain of generators, I encounter a segmentation fault.  For example, the following works as expected:

    % ./gen_bug3.py 10000
    10000
    %

But for sufficiently larger chain lengths, it seg faults:

    % ./gen_bug3.py 20000
    Segmentation fault (core dumped)
    %

and:

    % ./gen_bug3.py 100000
    Segmentation fault (core dumped)
    %

The exact point where it seg faults seems to vary slightly between different invocations of Python, but the range is very narrow for a given Python installation.  I believe the difference is due to slight variations in used memory upon startup.

I can't see any reason why this should happen, and in any case, if there is some limit that I'm exceeding, it should raise an exception rather than core dump.

I'm using:

    3.6.9 (default, Jul 17 2020, 12:50:27)
    [GCC 8.4.0]

on a 64-bit Ubuntu Linux system.

Additional info:  A friend of mine is running 3.7.9 on a Windows system.  In his case, the symptom is that the program produces no output for a sufficiently long generator chain (presumably it's silently crashing).  Additionally, he encounters the problem with much shorter generator chains than I do.  I suspect it's the same underlying problem.

----------
components: Interpreter Core
files: gen_bug3.py
messages: 377826
nosy: karzes
priority: normal
severity: normal
status: open
title: Long generator chain causes segmentation fault
type: crash
versions: Python 3.6
Added file: https://bugs.python.org/file49486/gen_bug3.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41912>
_______________________________________


More information about the New-bugs-announce mailing list