#4153 - Incorrect file write errors on race condition

Identifier #4153
Issue type Trivial issue (does not break functionality)
Title Incorrect file write errors on race condition
Status Completed
Handling member Chris Graham
Version 10.0.30
Addon core
Description If 1 web request is waiting on a lock in cms_file_put_contents_safe, it will write immediately on acquiring the lock - but the original locker will check the filesize of what it just wrote and see it as zero due to the new request in the process of writing.

This filesize check is unnecessary. We already check the number of bytes written is correct and have no reason to doubt the accuracy of it.
We could try and preserve a write lock by not using PHP's file_put_contents but rather fopen/fwrite and our own locking, to keep the lock open until filesize runs, but this is adding even more complexity to something that we can instead simplify.
Steps to reproduce

Funded? No
Commits

Fixed MANTIS-4153 (Incorrect file write errors on race condition) (0b15ee0e) · Commits · Composr ecosystem / Composr · GitLab

The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated