Skip to content

gh-113205: test_multiprocessing.test_terminate: Test the API on threadpools#114186

Merged
gpshead merged 1 commit into
python:mainfrom
encukou:threadpool-terminate-test
Jan 18, 2024
Merged

gh-113205: test_multiprocessing.test_terminate: Test the API on threadpools#114186
gpshead merged 1 commit into
python:mainfrom
encukou:threadpool-terminate-test

Conversation

@encukou

@encukou encukou commented Jan 17, 2024

Copy link
Copy Markdown
Member

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 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.

…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.

@gpshead gpshead left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

oh nice, yay!

@gpshead
gpshead merged commit c1db960 into python:main Jan 18, 2024
@miss-islington-app

Copy link
Copy Markdown

Thanks @encukou for the PR, and @gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

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>
@bedevere-app

bedevere-app Bot commented Jan 18, 2024

Copy link
Copy Markdown

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

@bedevere-app bedevere-app Bot removed the needs backport to 3.12 only security fixes label Jan 18, 2024
@bedevere-app

bedevere-app Bot commented Jan 18, 2024

Copy link
Copy Markdown

GH-114223 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 Jan 18, 2024
@encukou
encukou deleted the threadpool-terminate-test branch January 18, 2024 07:22
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants