Skip to content

lib2to3 generation of pickle files is racy #85357

Closed

Description

@barisione
mannequin
BPO 41185
Nosy @barisione
Superseder
  • bpo-45544: Close 2to3 issues and list them here
  • Files
  • pool.py: Reproducer
  • 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 2021-10-20.22:53:44.710>
    created_at = <Date 2020-07-01.16:05:44.911>
    labels = ['3.8', '3.7', 'expert-2to3', '3.9']
    title = 'lib2to3 generation of pickle files is racy'
    updated_at = <Date 2021-10-20.22:53:44.710>
    user = 'https://github.com/barisione'

    bugs.python.org fields:

    activity = <Date 2021-10-20.22:53:44.710>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-10-20.22:53:44.710>
    closer = 'iritkatriel'
    components = ['2to3 (2.x to 3.x conversion tool)']
    creation = <Date 2020-07-01.16:05:44.911>
    creator = 'barisione'
    dependencies = []
    files = ['49284']
    hgrepos = []
    issue_num = 41185
    keywords = []
    message_count = 1.0
    messages = ['372760']
    nosy_count = 1.0
    nosy_names = ['barisione']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = '45544'
    type = None
    url = 'https://bugs.python.org/issue41185'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8', 'Python 3.9']

    Activity

    1. barisione commented on Jul 1, 2020

      barisionemannequin
      MannequinAuthor

      The generation of pickle files in load_grammar in lib2to3/pgen2/driver.py is racy as other processes may end up reading a half-written pickle file.

      This is reproducible with the command line tool, but it's easier to reproduce by importing lib2to3. You just need different processes importing lib2to3 at the same time to make this happen, see the attached reproducer.

      I tried with Python 3.9 for completeness and, while it happens there as well, it seems to be less frequent ony my computer than when using Python 3.6 (2% failure rate instead of 50% failure rate).

    2. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions