Closed majuca closed 1 year ago
Has Prado the permissions to write that file? Looks like it's trying to write a 32 byte hash and to read it back, but the file looks empty (size = 0).
Yes I have the write permissions. I will do some test and come back...
Ok, this problem exists from a long time but it was never a problem for us until now. We are working with docker and some weeks ago, we switch to PHP 8.0 and to an alpine docker instead of a ubuntu docker. I don't know if it is php8 (probably yes, more faster) or the alpine docker but this bug was realy a problem after these changes.
Indeed, we have a lot of request comming at the same time and the problem is an none thread safe of the _write function in the TCache_Lite classe. When the function open the file by @fopen($this->_file, "wb"), the file is empty but it is still not blocked at this point. So if a other thread is calling filesize($this->_file) at the same time (_read function), the length is 0.
According to the php documentation, in the _write function, the file must be opend like this @fopen($this->_file, "cb"), blocked and only after that truncate.
I send pull request.
Merged, than you for the nice explanation!
Hi,
In one of ou application, each 5 minutes, we receive a lot of request from from differents servers. The number of request is growing and now I have a lot of time the folloming error:
Do you have an idee of this problem?
Maybe we should protect by checking if length is greater than 0.