Skip to content

Conversation

gvanrossum
Copy link
Member

@gvanrossum gvanrossum commented Oct 14, 2023

vstinner and others added 4 commits October 13, 2023 02:30
ThreadedChildWatcher._join_threads() now clears references to
completed threads.

test_asyncio.utils.TestCase now calls _join_threads() of the watcher,
uses SHORT_TIMEOUT to join a thread, and then raises an exception if
there are still running threads.

Rename also ThreadedChildWatcher threads to add "asyncio-" prefix to
the name.
@gvanrossum gvanrossum added tests Tests in the Lib/test dir topic-asyncio skip news needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Oct 14, 2023
@gvanrossum gvanrossum force-pushed the asyncio_clear_watcher_threads branch from fd13f23 to 566fb52 Compare October 15, 2023 00:25
@gvanrossum gvanrossum marked this pull request as ready for review October 15, 2023 09:25
@gvanrossum
Copy link
Member Author

Reviewers, please have a look at this comment in the issue for background on what I ended up doing:
#110205 (comment)

@gvanrossum
Copy link
Member Author

@graingert I wonder if you have time to review this?

Copy link
Contributor

@graingert graingert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah the old _join_threads was always a noop

@gvanrossum
Copy link
Member Author

Assuming this passes I will merge it and backport to 3.12 and 3.11.

@miss-islington-app
Copy link

Thanks @gvanrossum for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@gvanrossum gvanrossum deleted the asyncio_clear_watcher_threads branch October 27, 2023 22:44
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 27, 2023
…thonGH-110884)

- `ThreadedChildWatcher.close()` is now *officially* a no-op; `_join_threads()` never did anything.
- Threads created by that class are now named `asyncio-waitpid-NNN`.
- `test.test_asyncio.utils.TestCase.close_loop()` now waits for the child watcher's threads, but not forever; if a thread hangs, it raises `RuntimeError`.
(cherry picked from commit c3bb10c)

Co-authored-by: Guido van Rossum <guido@python.org>
@bedevere-app
Copy link

bedevere-app bot commented Oct 27, 2023

GH-111412 is a backport of this pull request to the 3.12 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 27, 2023
…thonGH-110884)

- `ThreadedChildWatcher.close()` is now *officially* a no-op; `_join_threads()` never did anything.
- Threads created by that class are now named `asyncio-waitpid-NNN`.
- `test.test_asyncio.utils.TestCase.close_loop()` now waits for the child watcher's threads, but not forever; if a thread hangs, it raises `RuntimeError`.
(cherry picked from commit c3bb10c)

Co-authored-by: Guido van Rossum <guido@python.org>
@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Oct 27, 2023
@bedevere-app
Copy link

bedevere-app bot commented Oct 27, 2023

GH-111413 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Oct 27, 2023
gvanrossum added a commit that referenced this pull request Oct 27, 2023
…H-110884) (#111412)

- `ThreadedChildWatcher.close()` is now *officially* a no-op; `_join_threads()` never did anything.
- Threads created by that class are now named `asyncio-waitpid-NNN`.
- `test.test_asyncio.utils.TestCase.close_loop()` now waits for the child watcher's threads, but not forever; if a thread hangs, it raises `RuntimeError`.
(cherry picked from commit c3bb10c)

Co-authored-by: Guido van Rossum <guido@python.org>
gvanrossum added a commit that referenced this pull request Oct 27, 2023
…H-110884) (#111413)

- `ThreadedChildWatcher.close()` is now *officially* a no-op; `_join_threads()` never did anything.
- Threads created by that class are now named `asyncio-waitpid-NNN`.
- `test.test_asyncio.utils.TestCase.close_loop()` now waits for the child watcher's threads, but not forever; if a thread hangs, it raises `RuntimeError`.
(cherry picked from commit c3bb10c)

Co-authored-by: Guido van Rossum <guido@python.org>
iritkatriel pushed a commit to iritkatriel/cpython that referenced this pull request Oct 29, 2023
…thon#110884)

- `ThreadedChildWatcher.close()` is now *officially* a no-op; `_join_threads()` never did anything.
- Threads created by that class are now named `asyncio-waitpid-NNN`.
- `test.test_asyncio.utils.TestCase.close_loop()` now waits for the child watcher's threads, but not forever; if a thread hangs, it raises `RuntimeError`.
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…thon#110884)

- `ThreadedChildWatcher.close()` is now *officially* a no-op; `_join_threads()` never did anything.
- Threads created by that class are now named `asyncio-waitpid-NNN`.
- `test.test_asyncio.utils.TestCase.close_loop()` now waits for the child watcher's threads, but not forever; if a thread hangs, it raises `RuntimeError`.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…thon#110884)

- `ThreadedChildWatcher.close()` is now *officially* a no-op; `_join_threads()` never did anything.
- Threads created by that class are now named `asyncio-waitpid-NNN`.
- `test.test_asyncio.utils.TestCase.close_loop()` now waits for the child watcher's threads, but not forever; if a thread hangs, it raises `RuntimeError`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir topic-asyncio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants