[New-bugs-announce] [issue17395] Wait for live children in test_multiprocessing

Ezio Melotti report at bugs.python.org
Mon Mar 11 07:06:13 CET 2013


New submission from Ezio Melotti:

While running test_multiprocessing I get:
[...]
test_wait_return (test.test_multiprocessing.WithManagerTestBarrier) ... ok
Shared objects which still exist at manager shutdown:
  b6b802d4:       refcount=1
    <threading.Barrier object at 0xb6b802d4>
  b6b80ea4:       refcount=1
    <threading.Event object at 0xb6b80ea4>
  b6b83264:       refcount=1
    [True, True, True, True]
  b6b836fc:       refcount=1
    [16092, 16094, 16091, 16096]
  b6b89884:       refcount=2
    <threading.Barrier object at 0xb6b89884>
  b6b89ea4:       refcount=1
    []
  b6b8b7dc:       refcount=1
    <queue.Queue object at 0xb6b8b7dc>
  b6b8bc3c:       refcount=1
    [16092, 16094, 16096, 16091]
test_notify (test.test_multiprocessing.WithManagerTestCondition) ... ok
[...]
test_event (test.test_multiprocessing.WithManagerTestEvent) ... ok
Shared objects which still exist at manager shutdown:
  b6dcc7a4:       refcount=1
    <threading.Event object at 0xb6dcc7a4>
test_lock (test.test_multiprocessing.WithManagerTestLock) ... ok
[...]

This seems to be caused by the fact that when multiprocessing.active_children() is called in test_multiprocessing.ManagerMixin.tearDownClass(), some of them are still marked as active.
I tried to add a sleep before the active_children() call and the output disappeared.  On my machine it takes about half second.

The attached patch checks in loop that there no active children left, waiting up to 5s in increasing time intervals starting from 0.01s (so in the best case scenario it won't wait at all, and in the worst it will wait ~5s and possibly report the shared objects that still exists).

----------
components: Tests
files: slowmulti.diff
keywords: patch
messages: 183935
nosy: ezio.melotti, jnoller, pitrou, sbt, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Wait for live children in test_multiprocessing
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file29372/slowmulti.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17395>
_______________________________________


More information about the New-bugs-announce mailing list