[New-bugs-announce] [issue4999] multiprocessing.Queue does not order objects

Frédéric Sagnes report at bugs.python.org
Mon Jan 19 13:57:25 CET 2009


New submission from Frédéric Sagnes <speedup+python at gmail.com>:

Objects contained in a multiprocessing.Queue object are not comming out
of the queue in the same order as they went in. For instance, if I put
in object1, object2 and object3 in this very time sequence from multiple
processes, they can end up comming out of the queue as object2, object1
then object3 instead of the original order.

When using the threading module instead of multiprocessing everything is
fine.

The provided test script adds strings to the queue with timestamps.
These messages are not ordered by timestamp when they are printed. This
is an output of the test script with format "[pid at time] message":

[2120 at 00406] Got lock
[2120 at 02424] Released lock
[2121 at 02426] Got lock
[2121 at 04439] Released lock
[...]
[2121 at 16459] Released lock
[2120 at 16461] Got lock
[2121 at 18464] Got lock
[2120 at 18462] Released lock
[2121 at 20466] Released lock

Using print to print the message immediatly prints the messages in the
right order.

See this mailing-list thread for details:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/11a5c4ce4ff4382d/033dcd3607eacbf9

----------
components: Extension Modules
files: testthreads.py
messages: 80162
nosy: ndfred
severity: normal
status: open
title: multiprocessing.Queue does not order objects
versions: Python 2.6
Added file: http://bugs.python.org/file12793/testthreads.py

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


More information about the New-bugs-announce mailing list