note 124969 rejected from function.flock by cmb

From: Date: Sat, 02 May 2020 11:03:25 +0000
Subject: note 124969 rejected from function.flock by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-214572@lists.php.net to get a copy of this message
Note Submitter: guy at inveniem dot com ---- We found that using flock() in conjunction with fputcsv() to allow concurrent processes to write 1,000+ rows results in 5% of the rows being lost for some reason. It did not matter whether we opened the file in append mode (a), or opened it in read-write (r+) mode and then seeked AFTER the flock() call -- either way, rows were lost. For this reason, we ended up having to use a separate lock file. Failing code, failing results, and passing code can be found here: https://gist.github.com/GuyPaddock/371d42970e94d0e3f1087db6d91bfe02

« previous php.notes (#214572) next »