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

race in logging code when fork() #80768

Closed
cagney mannequin opened this issue Apr 10, 2019 · 4 comments
Closed

race in logging code when fork() #80768

cagney mannequin opened this issue Apr 10, 2019 · 4 comments
Assignees
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@cagney
Copy link
Mannequin

cagney mannequin commented Apr 10, 2019

BPO 36587
Nosy @gpshead, @vsajip, @cagney
Files
  • btc.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 = 'https://github.com/gpshead'
    closed_at = <Date 2019-09-24.21:58:30.902>
    created_at = <Date 2019-04-10.14:14:38.663>
    labels = ['3.7', 'type-bug', 'library']
    title = 'race in logging code when fork()'
    updated_at = <Date 2019-09-24.21:58:30.894>
    user = 'https://github.com/cagney'

    bugs.python.org fields:

    activity = <Date 2019-09-24.21:58:30.894>
    actor = 'gregory.p.smith'
    assignee = 'gregory.p.smith'
    closed = True
    closed_date = <Date 2019-09-24.21:58:30.902>
    closer = 'gregory.p.smith'
    components = ['Library (Lib)']
    creation = <Date 2019-04-10.14:14:38.663>
    creator = 'cagney'
    dependencies = []
    files = ['48258']
    hgrepos = []
    issue_num = 36587
    keywords = []
    message_count = 4.0
    messages = ['339866', '339880', '352999', '353119']
    nosy_count = 3.0
    nosy_names = ['gregory.p.smith', 'vinay.sajip', 'cagney']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue36587'
    versions = ['Python 3.7']

    @cagney
    Copy link
    Mannequin Author

    cagney mannequin commented Apr 10, 2019

    Buried in bpo-36533; it should probably be turned into a test case.

    Exception ignored in: <function _after_at_fork_weak_calls at 0x7f7307550378>
    Traceback (most recent call last):
      File "/home/python/v3.7.3/lib/python3.7/logging/__init__.py", line
    269, in _after_at_fork_weak_calls
        _at_fork_weak_calls('release')
      File "/home/python/v3.7.3/lib/python3.7/logging/__init__.py", line
    254, in _at_fork_weak_calls
        for instance in _at_fork_acquire_release_weakset:
      File "/home/python/v3.7.3/lib/python3.7/_weakrefset.py", line 60, in __iter__
        for itemref in self.data:
    RuntimeError: Set changed size during iteration
    
    Exception in thread Thread-1:
    Traceback (most recent call last):
      File "/home/python/v3.7.3/lib/python3.7/threading.py", line 917, in
    _bootstrap_inner
        self.run()
      File "/home/python/v3.7.3/lib/python3.7/threading.py", line 865, in run
        self._target(*self._args, **self._kwargs)
      File "./btc.py", line 11, in lockie
        h = logging.Handler()
      File "/home/python/v3.7.3/lib/python3.7/logging/__init__.py", line
    824, in __init__
        self.createLock()
      File "/home/python/v3.7.3/lib/python3.7/logging/__init__.py", line
    847, in createLock
        _register_at_fork_acquire_release(self)
      File "/home/python/v3.7.3/lib/python3.7/logging/__init__.py", line
    250, in _register_at_fork_acquire_release
        _at_fork_acquire_release_weakset.add(instance)
      File "/home/python/v3.7.3/lib/python3.7/_weakrefset.py", line 83, in add
        self._commit_removals()
      File "/home/python/v3.7.3/lib/python3.7/_weakrefset.py", line 56, in
    _commit_removals
        discard(l.pop())
    IndexError: pop from empty list

    @cagney cagney mannequin added type-crash A hard crash of the interpreter, possibly with a core dump 3.7 (EOL) end of life stdlib Python modules in the Lib dir labels Apr 10, 2019
    @SilentGhost SilentGhost mannequin added type-bug An unexpected behavior, bug, or error and removed type-crash A hard crash of the interpreter, possibly with a core dump labels Apr 10, 2019
    @gpshead gpshead self-assigned this Apr 10, 2019
    @gpshead
    Copy link
    Member

    gpshead commented Apr 10, 2019

    yeah i saw that bug buried in there, this weakset goes away with my proposed PR.

    @vsajip
    Copy link
    Member

    vsajip commented Sep 23, 2019

    Is this issue still valid, or should it be closed as out of date?

    @gpshead
    Copy link
    Member

    gpshead commented Sep 24, 2019

    i don't have context for what test was needed where anymore, but #12704 removed the _at_fork_acquire_release_weakset.

    @gpshead gpshead closed this as completed Sep 24, 2019
    @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 stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants