Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[not for merge] tidying threads and file descriptors at shutdown #3397

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

benclifford
Copy link
Collaborator

this is a patch stack in my dev environment where i have been pushing on cleanup of threads and file descriptors at shutdown, with the eventual goal of having pytest fixtures assert that only the main thread is running and the same number of file descriptors are open at the start and the end. I've been merging work from this already in small pieces and will continue to merge small tidyups from it.

There is at least one large part which needs some thought and discussion, which is how to shut down the htex queue processing thread - the engine of almost everything in htex that doesn't happen immediately on user task submission.

@benclifford benclifford marked this pull request as draft April 25, 2024 07:28
@benclifford benclifford force-pushed the benc-stdstreams-bugs branch 4 times, most recently from ef0f2bf to ea3f8f7 Compare April 29, 2024 12:26
benclifford added a commit that referenced this pull request Jul 2, 2024
This stops that thread being left still running over the end of the
test - which is needed in work in PR #3397 to ensure that no threads
are left running at the end of a test.

If that shutdown hangs, this test will now hang rather than leave the
thread behind.

Along with PR #3504, this eliminates any threads left behind after
parsl/tests/test_providers/test_local_provider.py
benclifford added a commit that referenced this pull request Jul 3, 2024
This stops that thread being left still running over the end of the
test - which is needed in work in PR #3397 to ensure that no threads
are left running at the end of a test.

If that shutdown hangs, this test will now hang rather than leave the
thread behind.

Along with PR #3504, this eliminates any threads left behind after
parsl/tests/test_providers/test_local_provider.py
benclifford added a commit that referenced this pull request Aug 8, 2024
This releases 2 file descriptors with work queue (from 21 to 19 at the end
of CI Work Queue test) and 4 file descriptors with Task Vine (from 19 to 15
at the end of CI Task Vine test)

This is part of work being merged from draft PR #3397 to shut down components
more cleanly, rather than relying on process exit.
benclifford added a commit that referenced this pull request Aug 8, 2024
This releases 2 file descriptors with work queue (from 21 to 19 at the end
of CI Work Queue test) and 4 file descriptors with Task Vine (from 19 to 15
at the end of CI Task Vine test)

This is part of work being merged from draft PR #3397 to shut down components
more cleanly, rather than relying on process exit.
@benclifford benclifford force-pushed the benc-stdstreams-bugs branch 2 times, most recently from e2b0448 to 96f1e63 Compare August 16, 2024 13:01
Before this PR, this thread stays running forever, until it is terminated
by Python process exit.

After this PR, this thread polls an flag once per second, then properly
closes the ZMQ socket that it is using.

pytest parsl/tests/test_monitoring/ --config local
Before this PR, at end of test: 32 threads, 451 fds open.

After this PR, at end of test: 1 thread, 48 fds open.
.. and use that new parameter in stderr/out tests which don't make use of
the UDP radio.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant