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 ocean-city
Recipients ocean-city, pitrou
Date 2010-07-19.01:50:41
SpamBayes Score 6.1212355e-05
Marked as misclassified No
Message-id <1279504244.95.0.248409231195.issue9295@psf.upfronthosting.co.za>
In-reply-to
Content
> Does the following patch solve your issue?

I tried, but it still crashed. I could reproduce the crash by following
script. It crashed also on Python2.7, but it doesn't crash on Python3.
And when I used io.open() instead of builtin open(), it doesn't crash
even on Python2.x. (Probably because io.open implements buffer protocol
by itself)

//////////////////////////////////////////////////////

import threading
import sys

if sys.version_info.major == 3:
    xrange = range

def main():
    size = 1024 * 1024 # large enough
    f = open("__temp__.tmp", "w", size)
    for _ in xrange(size):
        f.write("c")
    t1 = threading.Thread(target=f.close)
    t2 = threading.Thread(target=f.close)
    t1.start()
    t2.start()
    t1.join()
    t2.join()

if __name__ == '__main__':
    main()

//////////////////////////////////////////////////////

I lied a bit on msg110655. close(2) is not used, that is actually
fclose(). I didn't notice the variable *close* was declared as
the parameter of fill_file_fields().
History
Date User Action Args
2010-07-19 01:50:45ocean-citysetrecipients: + ocean-city, pitrou
2010-07-19 01:50:44ocean-citysetmessageid: <1279504244.95.0.248409231195.issue9295@psf.upfronthosting.co.za>
2010-07-19 01:50:42ocean-citylinkissue9295 messages
2010-07-19 01:50:41ocean-citycreate