GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — GH-110829: Ensure Thread.join() joins the OS thread by pitrou · Pull Request #110848 · python/cpython Conversation
|
|
@gpshead This should work at least on Linux, hopefully on Windows if I'm lucky. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
ef411ef to
41b9cba
Compare
|
🤖 New build scheduled with the buildbot fleet by @pitrou for commit 6c594ce 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@zooba I think my use of the Windows APIs is correct here, but you might want to take a look. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| unsigned long long ull_handle = PyLong_AsUnsignedLongLong(handle_obj); | ||
| if ((*ident == (unsigned long) -1 || ull_handle == (unsigned long long) -1) | ||
| && PyErr_Occurred()) { | ||
| // This should not occur as we control the contents of state->joinable_dict | ||
| return -1; | ||
| } | ||
| *handle = (Py_uintptr_t) ull_handle; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I filed #110863 to ease this a bit.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| def test_terminate(self): | ||
| if self.TYPE == 'threads': | ||
| self.skipTest("Threads cannot be terminated") |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Note the changes in this file are probably not necessary, it's just that without them the threads emulation of processes takes a very long time to test. The reason is simple and not related to this PR: while you can terminate a process early, you cannot do that on a thread, so joining a sleeping thread has to wait for the sleep to finish.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We can use a shorter wait time rather than skip the test entirely: #114186
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } else { | ||
| PyThread_detach_thread((Py_uintptr_t) handle); | ||
| } | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We might also want to emit a ResourceWarning here, what do you think @vstinner ?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thinking about it, I'd rather defer this to a later PR (if at all).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
!buildbot wasm |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🤖 New build scheduled with the buildbot fleet by @pitrou for commit 26e868c 🤖 The command will test the builders whose names match following regular expression: The builders matched are:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Most buildbots are green and the few failures look unrelated: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
26e868c to
e2f440f
Compare
|
🤖 New build scheduled with the buildbot fleet by @pitrou for commit e2f440f 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I formally announce that there are no buildbot failures :-) I realize that this PR lacks some docs for the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I'll take a look this week, I was on vacation. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
2546653 to
96849d1
Compare
|
🤖 New build scheduled with the buildbot fleet by @pitrou for commit 5cf2684 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
In an ironic (and depressing) twist, it seems that even after |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
doh! I guess I can understand why, the thread won't be executing anymore so join succeeded but the in kernel data structure cleanup will take its own sweet time. :/ I still think it is a valuable addition that we wait for the OS join to happen (thanks for all this work, reviews & merge) but I understand it is annoying given one of the motivating reasons. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…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.
…dpools (#114186) gh-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 GH-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.
… 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 <[email protected]>
… 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 <[email protected]>
… 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.
… 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.
… 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.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Nice
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.