gh-91351: Fix some bugs in importlib handling of re-entrant imports by exarkun · Pull Request #94504 · python/cpython

added 3 commits

June 30, 2022 18:58
This might make it a little bit easier for a new reader/maintainer to
understand what this code is doing.

Also, link to a couple application-level bug reports about probable
misbehaviors related to the deadlock-detection code.
This more clearly separates the logic for that management from the application
code that runs in this context.

It will also make subsequent changes to improve that logic more clear.
Also update the deadlock detection to work with the new _blocking_on

Switch to a recursive implementation so it can easily follow the branching
path through the "blocking on" graph that is now possible thanks to
re-entrancy.

@brettcannon brettcannon changed the title gn-91351: Fix some bugs in importlib handling of re-entrant imports gh-91351: Fix some bugs in importlib handling of re-entrant imports

Jul 4, 2022

brettcannon

Co-authored-by: Brett Cannon <brett@python.org>

@exarkun

@exarkun

Also rename it as suggested by review

@exarkun

@exarkun

@exarkun

@exarkun

@exarkun

@exarkun

@exarkun

Co-authored-by: Brett Cannon <brett@python.org>

@exarkun

@exarkun

brettcannon

brettcannon

@exarkun @brettcannon

Co-authored-by: Brett Cannon <brett@python.org>

brettcannon

This was referenced

May 21, 2023

facebook-github-bot pushed a commit to facebookincubator/cinder that referenced this pull request

Feb 12, 2024
…imports

Summary:
upstream issue: python/cpython#91351
upstream PR: python/cpython#94504
upstream merge commit: python/cpython@3325f05

symptom:

```
File "<frozen importlib._bootstrap>", line 1004, in _find_and_load(name='oe.gpg_sign', import_=<built-in function __import__>)
File "<frozen importlib._bootstrap>", line 158, in _ModuleLockManager.__enter__()
File "<frozen importlib._bootstrap>", line 110, in _ModuleLock.acquire()
KeyError: 139622474778432

and

File "<frozen importlib._bootstrap>", line 1004, in _find_and_load(name='oe.path', import_=<built-in function __import__>)
File "<frozen importlib._bootstrap>", line 158, in _ModuleLockManager.__enter__()
File "<frozen importlib._bootstrap>", line 110, in _ModuleLock.acquire()
KeyError: 140438942700992
```

Reviewed By: carljm

Differential Revision: D53641441

fbshipit-source-id: e142eb17442da370861cd3a3398b0eef9930d041