[New-bugs-announce] [issue4607] uuid behavior with multiple threads

Morten Bentsen report at bugs.python.org
Tue Dec 9 11:13:33 CET 2008

New submission from Morten Bentsen <mortenab at gmail.com>:

The uuid module uses a single global buffer for storing random values 
obtained from the system. This can (and does) cause non-uniqueness of 
generated id's when using the uuid4 function in a multithreaded program.

The following snippet shows the problem - _buffer is the global buffer:

    # When the system provides a version-4 UUID generator, use it.
    if _uuid_generate_random:
        return UUID(bytes=_buffer.raw)

components: Library (Lib)
messages: 77401
nosy: mortenab
severity: normal
status: open
title: uuid behavior with multiple threads
type: behavior
versions: Python 2.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list