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

crash reimporting posix after Py_Finalize on mac #82112

Closed
benoithudson mannequin opened this issue Aug 23, 2019 · 6 comments
Closed

crash reimporting posix after Py_Finalize on mac #82112

benoithudson mannequin opened this issue Aug 23, 2019 · 6 comments
Labels
3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-mac type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@benoithudson
Copy link
Mannequin

benoithudson mannequin commented Aug 23, 2019

BPO 37931
Nosy @ronaldoussoren, @vstinner, @ned-deily, @miss-islington, @benoithudson, @iritkatriel
PRs
  • bpo-37931: crash on OSX re-initializing os.environ #15428
  • [3.8] bpo-37931: Fix crash on OSX re-initializing os.environ (GH-15428) #17488
  • Files
  • crashy.c
  • 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 2020-10-18.18:02:08.502>
    created_at = <Date 2019-08-23.15:39:47.712>
    labels = ['OS-mac', 'interpreter-core', '3.9', 'type-crash']
    title = 'crash reimporting posix after Py_Finalize on mac'
    updated_at = <Date 2020-10-18.18:02:08.501>
    user = 'https://github.com/benoithudson'

    bugs.python.org fields:

    activity = <Date 2020-10-18.18:02:08.501>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-10-18.18:02:08.502>
    closer = 'vstinner'
    components = ['Interpreter Core', 'macOS']
    creation = <Date 2019-08-23.15:39:47.712>
    creator = 'Benoit Hudson'
    dependencies = []
    files = ['48559']
    hgrepos = []
    issue_num = 37931
    keywords = ['patch']
    message_count = 6.0
    messages = ['350309', '354387', '357940', '357942', '378789', '378880']
    nosy_count = 6.0
    nosy_names = ['ronaldoussoren', 'vstinner', 'ned.deily', 'miss-islington', 'Benoit Hudson', 'iritkatriel']
    pr_nums = ['15428', '17488']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue37931'
    versions = ['Python 2.7', 'Python 3.9']

    @benoithudson
    Copy link
    Mannequin Author

    benoithudson mannequin commented Aug 23, 2019

    On OSX, with --enable-shared, if you shut down python and reinitialize, you can get a crash.

    Repro steps: see attached crashy.c
    gcc -I. -I ../Include/ -L. crashy.c -lpython3.9
    ./a.out

    On OSX, with --enable-shared, you get a crash! On other platforms including on OSX static builds, no crash.

    Not a regression: it's present in 2.7 (where we actually hit it).

    PR incoming, the fix is simple. It has to do with caching (on OSX shared builds only) a stale value for the environment when building os.environ the first time; if you change the environment, the second initialization reads garbage when building os.environ.

    @benoithudson benoithudson mannequin added 3.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-mac type-crash A hard crash of the interpreter, possibly with a core dump labels Aug 23, 2019
    @benoithudson
    Copy link
    Mannequin Author

    benoithudson mannequin commented Oct 10, 2019

    Ping! The patch has been ready for review for over a month.

    If the patch can be backported to 2.7.x before that gets end-of-lifed it would be ideal.

    @vstinner
    Copy link
    Member

    vstinner commented Dec 6, 2019

    New changeset 723f71a by Victor Stinner (Benoit Hudson) in branch 'master':
    bpo-37931: Fix crash on OSX re-initializing os.environ (GH-15428)
    723f71a

    @miss-islington
    Copy link
    Contributor

    New changeset 836cf31 by Miss Islington (bot) in branch '3.8':
    bpo-37931: Fix crash on OSX re-initializing os.environ (GH-15428)
    836cf31

    @iritkatriel
    Copy link
    Member

    Can this be closed?

    @vstinner
    Copy link
    Member

    Right, I close the issue.

    @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.9 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-mac type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants