This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: race in logging code when fork()
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: cagney, gregory.p.smith, vinay.sajip
Priority: normal Keywords:

Created on 2019-04-10 14:14 by cagney, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
btc.py cagney, 2019-04-10 14:14
Messages (4)
msg339866 - (view) Author: cagney (cagney) Date: 2019-04-10 14:14
Buried in issue36533; 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
msg339880 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2019-04-10 18:55
yeah i saw that bug buried in there, this weakset goes away with my proposed PR.
msg352999 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2019-09-23 09:25
Is this issue still valid, or should it be closed as out of date?
msg353119 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2019-09-24 21:58
i don't have context for what test was needed where anymore, but https://github.com/python/cpython/pull/12704 removed the _at_fork_acquire_release_weakset.
History
Date User Action Args
2022-04-11 14:59:13adminsetgithub: 80768
2019-09-24 21:58:30gregory.p.smithsetstatus: open -> closed
resolution: out of date
messages: + msg353119

stage: resolved
2019-09-23 09:25:25vinay.sajipsetmessages: + msg352999
2019-04-10 18:55:18gregory.p.smithsetmessages: + msg339880
2019-04-10 18:54:49gregory.p.smithsetassignee: gregory.p.smith
2019-04-10 14:25:12SilentGhostsetnosy: + gregory.p.smith, vinay.sajip
type: crash -> behavior
2019-04-10 14:14:38cagneycreate