This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, gpolo
Date 2008-06-19.12:28:50
SpamBayes Score 0.21061836
Marked as misclassified No
Message-id <1213878533.13.0.714434027203.issue3139@psf.upfronthosting.co.za>
In-reply-to
Content
The problem is not only about concurrent prints.
It is about invalid pointer passed to a C function.
Here is an example that reliably crashes the interpreter on my windows
machine:

import bz2, threading
bz2c = bz2.BZ2Compressor()
b = bytearray(b"a" * 1000000)
def f():
    for x in range(10):
        b[:] = b""
        b[:] = bytearray(b"a" * 1000000)
threading.Thread(target=f).start()
for x in range(10):
    bz2c.compress(b)

bz2c.compress is a slow function, that happens to accept bytearray and
to release the GIL. If the other thread reallocates the bytearray,
bz2c.compress will read invalid data.
History
Date User Action Args
2008-06-19 12:28:53amaury.forgeotdarcsetspambayes_score: 0.210618 -> 0.21061836
recipients: + amaury.forgeotdarc, gpolo
2008-06-19 12:28:53amaury.forgeotdarcsetspambayes_score: 0.210618 -> 0.210618
messageid: <1213878533.13.0.714434027203.issue3139@psf.upfronthosting.co.za>
2008-06-19 12:28:52amaury.forgeotdarclinkissue3139 messages
2008-06-19 12:28:51amaury.forgeotdarccreate