Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
9fa1eecf
Commit
9fa1eecf
authored
Aug 29, 2013
by
Richard Oudkerk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8713: Print dangling processes/threads, if any.
parent
e481c608
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
Lib/test/_test_multiprocessing.py
Lib/test/_test_multiprocessing.py
+17
-2
No files found.
Lib/test/_test_multiprocessing.py
View file @
9fa1eecf
...
...
@@ -3730,9 +3730,15 @@ def install_tests_in_module_dict(remote_globs, start_method):
Temp
.
__module__
=
__module__
remote_globs
[
name
]
=
Temp
dangling
=
[
None
,
None
]
old_start_method
=
[
None
]
def
setUpModule
():
multiprocessing
.
set_forkserver_preload
(
PRELOAD
)
remote_globs
[
'old_start_method'
]
=
multiprocessing
.
get_start_method
()
multiprocessing
.
process
.
_cleanup
()
dangling
[
0
]
=
multiprocessing
.
process
.
_dangling
.
copy
()
dangling
[
1
]
=
threading
.
_dangling
.
copy
()
old_start_method
[
0
]
=
multiprocessing
.
get_start_method
()
try
:
multiprocessing
.
set_start_method
(
start_method
)
except
ValueError
:
...
...
@@ -3750,9 +3756,18 @@ def install_tests_in_module_dict(remote_globs, start_method):
multiprocessing
.
get_logger
().
setLevel
(
LOG_LEVEL
)
def
tearDownModule
():
multiprocessing
.
set_start_method
(
remote_globs
[
'old_start_method'
])
multiprocessing
.
set_start_method
(
old_start_method
[
0
])
# pause a bit so we don't get warning about dangling threads/processes
time
.
sleep
(
0.5
)
multiprocessing
.
process
.
_cleanup
()
gc
.
collect
()
tmp
=
set
(
multiprocessing
.
process
.
_dangling
)
-
set
(
dangling
[
0
])
if
tmp
:
print
(
'Dangling processes:'
,
tmp
,
file
=
sys
.
stderr
)
del
tmp
tmp
=
set
(
threading
.
_dangling
)
-
set
(
dangling
[
1
])
if
tmp
:
print
(
'Dangling threads:'
,
tmp
,
file
=
sys
.
stderr
)
remote_globs
[
'setUpModule'
]
=
setUpModule
remote_globs
[
'tearDownModule'
]
=
tearDownModule
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment