Skip to content

gh-90369: change test server threads to joinable #135560

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

duaneg
Copy link
Contributor

@duaneg duaneg commented Jun 16, 2025

These were made daemons in an otherwise unrelated commit. The test code that joins them was not deleted and still works, so they can just be made joinable again.

These were made daemons in an otherwise unrelated commit. The test code that
joins them was not deleted and still works, so they can just be made joinable
again.
@duaneg duaneg requested a review from a team as a code owner June 16, 2025 11:25
@bedevere-app bedevere-app bot added awaiting review tests Tests in the Lib/test dir labels Jun 16, 2025
@duaneg
Copy link
Contributor Author

duaneg commented Jun 16, 2025

This does not impact users in any way, so IIUC it doesn't need a NEWS entry.

Copy link
Member

@ZeroIntensity ZeroIntensity left a comment

Choose a reason for hiding this comment

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

From what I understand, daemon threads are still useful even when joining, because they allow you to close them with a single CTRL+C. With a non-daemon thread, you have to interrupt it twice: once to stop the join in Python, and once more to stop the join by the interpreter.

What's the rationale here?

@duaneg
Copy link
Contributor Author

duaneg commented Jun 17, 2025

What's the rationale here?

It prevents a potential crash if a broken test exits uncleanly and doesn't join, as per the code in the original issue, but this is all very theoretical, for sure. As I said in the issue: I would not normally consider this sort of change worthwhile, but it looked like the threads may have been made daemons by mistake1, it is a trivial change, and I was under the impression we2 prefer joinable threads, all being equal.

If you or others don't think it is a good idea I am happy to withdraw it. Note that IMO #90369 should be closed regardless: it is doing things it shouldn't with internal test code.

1 Although, given your point about single CTRL-Cs, possibly it a convenience/QoL tweak by a dev who was frequently interrupting tests during development?
2 As in, CPython devs as a whole. My own personal preferences match yours, but I wouldn't propose changes just because of that!

@ZeroIntensity
Copy link
Member

ZeroIntensity commented Jun 17, 2025

possibly it a convenience/QoL tweak by a dev who was frequently interrupting tests during development

Probably. IIRC, we do something similar for the --parallel-threads option in regrtest. I'm not going to explicitly block this by requesting changes or closing, but I think it'd be good to leave this as-is and then close the attached issue.

@duaneg
Copy link
Contributor Author

duaneg commented Jun 17, 2025

As I said, I'm perfectly happy with that outcome. I'll leave it for a while in case anyone else wants to weigh in, especially the dev who changed them to daemon threads originally, but otherwise I'll close it myself if no-one else does first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants