[issue9295] test_close_open_print_buffered(test_file) sometimes crashes

Hirokazu Yamamoto report at bugs.python.org
Sun Jul 18 17:14:01 CEST 2010


Hirokazu Yamamoto <ocean-city at m2.ccsnet.ne.jp> added the comment:

I saw value of local variable *thread* was 5384 and internal buffer's address was 0x102618c8 (sorry, this is another stacktrace which differs from previous one)

thread(5384) func(file_close): enter....
thread(5384) func(close_the_file): enter....
thread(5384) func(close_the_file): file(00A1FB18) address(00B18FD0): local_close enter...
thread(5376) func(file_close): enter....
thread(5376) func(close_the_file): enter....
thread(5376) func(close_the_file): leave....
thread(5376) func(file_close): file(00A1FB18) address(00B18FD0): PyMem_Free
thread(5376) func(file_close): leave....

Thread 5384 entered close_the_file() and ran local_close() and allowed another thread to run. Before this, fp->f_fp was set to NULL. Thread 5376 entered close_the_file() and see fp->f_fp is NULL, and returned immediately and freed fp->f_setbuf. Interesting point is, thread 5384 was still running close(2), so flush(2) called by this function touched this buffer and crashed.

----------
keywords: +patch
Added file: http://bugs.python.org/file18050/py26_debug_threaded_close.patch

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


More information about the Python-bugs-list mailing list