From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0) Description of problem: When using buffered I/O calls (fopen, fread, fwrite, fclose) to read and write files from multithreaded programs, data corruption occurs when run on multiprocessor machine. The same program using non-buffered calls (open, close, read, write) works fine. How reproducible: Always Steps to Reproduce: 1. Build attached freadtest.cpp program using "g++ freadtest.cpp -o freadtest -lpthread" 2. Run freadtest 3. Build readtest.cpp program using "g++ readtest.cpp -o readtest - lpthread" to see working version using non-buffered calls Actual Results: In the buffered I/O version, around 3-5% of the time the data gets corrupted. Expected Results: In the non-buffered I/O version, the data is never corrupted. Additional info:
Created attachment 23547 [details] Sample code to reproduce problem
Created attachment 23548 [details] Sample code of working version using non-buffered calls
Cannot reproduce this (2way PIII). I was running /bin/true loop with this for several hours without getting any corruption.