gh-113205: test_multiprocessing.test_terminate: Test the API on threadpools#114186
Merged
Conversation
…rks on threadpools Threads can't be forced to terminate (without potentially corrupting too much state), so the expected behaviour of `ThreadPool.terminate` is to wait for the currently executing tasks to finish. The entire test was skipped in pythonGH-110848 (0e9c364). Instead of skipping it entirely, we should ensure the API eventually succeeds: use a shorter timeout. For the record: on my machine, when the test is un-skipped, the task manages to start in about 1.5% cases.
pitrou
approved these changes
Jan 17, 2024
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jan 18, 2024
… threadpools (pythonGH-114186) pythongh-113205: test_multiprocessing.test_terminate: Test the API works on threadpools Threads can't be forced to terminate (without potentially corrupting too much state), so the expected behaviour of `ThreadPool.terminate` is to wait for the currently executing tasks to finish. The entire test was skipped in pythonGH-110848 (0e9c364). Instead of skipping it entirely, we should ensure the API eventually succeeds: use a shorter timeout. For the record: on my machine, when the test is un-skipped, the task manages to start in about 1.5% cases. (cherry picked from commit c1db960) Co-authored-by: Petr Viktorin <encukou@gmail.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jan 18, 2024
… threadpools (pythonGH-114186) pythongh-113205: test_multiprocessing.test_terminate: Test the API works on threadpools Threads can't be forced to terminate (without potentially corrupting too much state), so the expected behaviour of `ThreadPool.terminate` is to wait for the currently executing tasks to finish. The entire test was skipped in pythonGH-110848 (0e9c364). Instead of skipping it entirely, we should ensure the API eventually succeeds: use a shorter timeout. For the record: on my machine, when the test is un-skipped, the task manages to start in about 1.5% cases. (cherry picked from commit c1db960) Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
GH-114222 is a backport of this pull request to the 3.12 branch. |
|
GH-114223 is a backport of this pull request to the 3.11 branch. |
encukou
added a commit
that referenced
this pull request
Jan 18, 2024
…for threadpools (GH-114186) (GH-114222) Threads can't be forced to terminate (without potentially corrupting too much state), so the expected behaviour of `ThreadPool.terminate` is to wait for the currently executing tasks to finish. Use shorter sleep time for threadpools, so if a task manages to start, the test doesn't block for long. (cherry picked from commit c1db960) Co-authored-by: Petr Viktorin <encukou@gmail.com>
encukou
added a commit
that referenced
this pull request
Jan 18, 2024
…for threadpools (GH-114186) (GH-114223) Threads can't be forced to terminate (without potentially corrupting too much state), so the expected behaviour of `ThreadPool.terminate` is to wait for the currently executing tasks to finish. Use shorter sleep time for threadpools, so if a task manages to start, the test doesn't block for long. (cherry picked from commit c1db960) Co-authored-by: Petr Viktorin <encukou@gmail.com>
kulikjak
pushed a commit
to kulikjak/cpython
that referenced
this pull request
Jan 22, 2024
… threadpools (python#114186) pythongh-113205: test_multiprocessing.test_terminate: Test the API works on threadpools Threads can't be forced to terminate (without potentially corrupting too much state), so the expected behaviour of `ThreadPool.terminate` is to wait for the currently executing tasks to finish. The entire test was skipped in pythonGH-110848 (0e9c364). Instead of skipping it entirely, we should ensure the API eventually succeeds: use a shorter timeout. For the record: on my machine, when the test is un-skipped, the task manages to start in about 1.5% cases.
aisk
pushed a commit
to aisk/cpython
that referenced
this pull request
Feb 11, 2024
… threadpools (python#114186) pythongh-113205: test_multiprocessing.test_terminate: Test the API works on threadpools Threads can't be forced to terminate (without potentially corrupting too much state), so the expected behaviour of `ThreadPool.terminate` is to wait for the currently executing tasks to finish. The entire test was skipped in pythonGH-110848 (0e9c364). Instead of skipping it entirely, we should ensure the API eventually succeeds: use a shorter timeout. For the record: on my machine, when the test is un-skipped, the task manages to start in about 1.5% cases.
Glyphack
pushed a commit
to Glyphack/cpython
that referenced
this pull request
Sep 2, 2024
… threadpools (python#114186) pythongh-113205: test_multiprocessing.test_terminate: Test the API works on threadpools Threads can't be forced to terminate (without potentially corrupting too much state), so the expected behaviour of `ThreadPool.terminate` is to wait for the currently executing tasks to finish. The entire test was skipped in pythonGH-110848 (0e9c364). Instead of skipping it entirely, we should ensure the API eventually succeeds: use a shorter timeout. For the record: on my machine, when the test is un-skipped, the task manages to start in about 1.5% cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Threads can't be forced to terminate (without potentially corrupting too much state), so the expected behaviour of
ThreadPool.terminateis to wait for the currently executing tasks to finish.The entire terminate test was skipped in GH-110848 (0e9c364). Instead of skipping it entirely, we should ensure the API eventually succeeds.
For the record: on my machine, when the test is un-skipped on 3.12, the task manages to start in about 1.5% cases.
On older branches, the test is not skipped, so it occasionally takes 5 minutes. The backports will fix issue #113205.
multiprocessing.test.*.test_threadscan take 10 minutes #113205