-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-104090: Update Resource Tracker to return exit code based on resource leaked found or not #106807
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
gh-104090: Update Resource Tracker to return exit code based on resource leaked found or not #106807
Changes from 12 commits
70a35a2
da7e245
1de022d
48bea84
31bc4af
47551a3
a02fdbe
9d0369e
4dbb777
bfd1e8e
043ae90
850b5bb
6e82940
a5cb934
ccd736c
3b21d5c
fbd18ec
e258cb3
5b886bf
915c8a3
cd377e6
27245ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -290,6 +290,31 @@ def _assert_logged(self, msg): | |
| create_executor_tests(FailingInitializerMixin) | ||
|
|
||
|
|
||
| @unittest.skipIf(sys.platform == "win32", "Resource Tracker doesn't run on Windows") | ||
| class FailingInitializerResourcesTest(unittest.TestCase): | ||
| """ | ||
| Source: https://github.com/python/cpython/issues/104090 | ||
| """ | ||
|
|
||
| def _test(self, test_class): | ||
| runner = unittest.TextTestRunner() | ||
| runner.run(test_class('test_initializer')) | ||
|
||
|
|
||
| # GH-104090: | ||
| # Stop resource tracker manually now, so we can verify there are not leaked resources by checking | ||
| # the process exit code | ||
| from multiprocessing.resource_tracker import _resource_tracker | ||
| _resource_tracker._stop() | ||
|
|
||
| self.assertEqual(_resource_tracker._exitcode, 0) | ||
|
|
||
| def test_spawn(self): | ||
| self._test(ProcessPoolSpawnFailingInitializerTest) | ||
|
|
||
| def test_forkserver(self): | ||
| self._test(ProcessPoolForkserverFailingInitializerTest) | ||
|
|
||
|
|
||
| class ExecutorShutdownTest: | ||
| def test_run_after_shutdown(self): | ||
| self.executor.shutdown() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| The multiprocessing resource tracker now exits with status code 1 if a resource | ||
| leak was detected. It still exits with status code 0 otherwise. |
Uh oh!
There was an error while loading. Please reload this page.