| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@gpshead This should work at least on Linux, hopefully on Windows if I'm lucky. |
Sorry, something went wrong.
|
@zooba I think my use of the Windows APIs is correct here, but you might want to take a look. |
Sorry, something went wrong.
| 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.
I filed #110863 to ease this a bit.
Sorry, something went wrong.
|
|
||
| def test_terminate(self): | ||
| if self.TYPE == 'threads': | ||
| self.skipTest("Threads cannot be terminated") |
There was a problem hiding this comment.
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 a problem hiding this comment.
We can use a shorter wait time rather than skip the test entirely: #114186
Sorry, something went wrong.
| } else { | ||
| PyThread_detach_thread((Py_uintptr_t) handle); | ||
| } | ||
| } |
There was a problem hiding this comment.
We might also want to emit a ResourceWarning here, what do you think @vstinner ?
Sorry, something went wrong.
There was a problem hiding this comment.
Thinking about it, I'd rather defer this to a later PR (if at all).
Sorry, something went wrong.
|
!buildbot wasm |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @pitrou for commit 26e868c 🤖 The command will test the builders whose names match following regular expression: wasm The builders matched are:
|
Sorry, something went wrong.
|
Most buildbots are green and the few failures look unrelated: |
Sorry, something went wrong.
|
I formally announce that there are no buildbot failures :-) I realize that this PR lacks some docs for the _thread additions, but before that I would like someone to vet the overall approach. @gpshead Are you available for a review? |
Sorry, something went wrong.
I'll take a look this week, I was on vacation. |
Sorry, something went wrong.
|
In an ironic (and depressing) twist, it seems that even after pthread_join returned successfully, the given thread can still appear in /proc/self/task. Forking should be safe in such a situation, but our fork() wrapper prints a warning nevertheless.... |
Sorry, something went wrong.
|
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.
…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 <encukou@gmail.com>
… 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>
… 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.
Nice
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.