View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004153||Composr||core||public||2020-02-28 00:31||2020-02-28 00:31|
|Reporter||Chris Graham||Assigned To||Chris Graham|
|Fixed in Version||10.0.31|
|Summary||0004153: Incorrect file write errors on race condition|
|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.
|Tags||No tags attached.|
|Time estimation (hours)|
Fixed in git commit 0b15ee0ed (https://gitlab.com/composr-foundation/composr/commit/0b15ee0ed - link will become active once code pushed to GitLab)
A hotfix (a TAR of files to upload) has been uploaded to this issue. These files are made to the latest intra-version state (i.e. may roll in earlier fixes too if made to the same files) - so only upload files newer than what you have already. If there are files in a hot-fix that you don't have then they probably relate to addons that you don't have installed and should be skipped. Always take backups of files you are replacing or keep a copy of the manual installer for your version, and only apply fixes you need. These hotfixes are not necessarily reliable or well supported. Not sure how to extract TAR files to your Windows computer? Try 7-zip (http://www.7-zip.org/).
hotfix-4153, 2020-02-28 12am.tar (34,304 bytes)