Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save - Inside workerman event threads Save() throws fopen() error #911

Closed
1 task done
eharris2000 opened this issue Mar 11, 2024 · 4 comments
Closed
1 task done
Assignees

Comments

@eharris2000
Copy link

What type of issue is this?

Exception/Error/Warning/Notice/Deprecation

Operating system + version

Debian 12 Docker

PHP version

PHP 8.3.2-1+020240120.16+debian121.gbpb43448 (cli) (built: Jan 20 2024 14:14:39) (NTS)

Connector/Database version (if applicable)

Files Adapter

Phpfastcache version

9.2.0 ✅

Describe the issue you're facing

Was seeing an issue during integration so created 5 test cases. Have phpfastcache running in two separate workerman threads. One thread creates items in the cache, the other thread reads items out of the cache and deletes them. On first pass, first worker inserts 3 items ( 1 every 3 seconds ). second worker ( 1 every 10 seconds ) reads the 3 messages. This functions properly. when the first worker makes its next pass ( second 12 ) I get a PHP Warning fopen(/tmp/phpfastcache/Files/79/dd/79dd8d25a5c369c941848966a79e5016.txt): Failed to open stream: No such file or directory in /home/resptech/vendor/phpfastcache/phpfastcache/lib/Phpfastcache/Core/Pool/IO/IOHelperTrait.php on line 305

Unfortunately, the save function also return true.
tests.tar.gz

Expected behavior

Should not throw error message and should save against subsequent calls.

Code sample (optional)

Uploaded samples as part of Describe Issue section. composer.json below

{
"require": {
"firebase/php-jwt": "^6.5",
"php-mqtt/client": "^1.8",
"monolog/monolog": "^3.4",
"qmegas/memcache-search": "^0.1.2",
"workerman/mqtt": "v1.5",
"workerman/channel": "^1.2",
"kreait/firebase-php": "7.9.1",
"oittaa/uuid": "v1.9",
"phpfastcache/phpfastcache": "9.2.3"
},
"require-dev": {
"squizlabs/php_codesniffer": "dev-master",
"phpstan/phpstan": "^1.10"
},
"autoload": {
"psr-4": {
"tuuk\": "tuuk/",
"app\": "app/"
}
}
}

Suggestion to fix the issue (optional)

No response

References (optional)

No response

Do you have anything more you want to share? (optional)

No response

Have you searched in our Wiki before posting ?

  • I have searched over the Wiki
Copy link

Hello curious contributor !
Since it seems to be your first contribution, make sure that you've been:

  • Reading and searching out our WIKI
  • Reading and agreed with our Code Of Conduct
  • Reading and understood our Coding Guideline
  • Reading our README
    If everything looks unclear to you, tell us what 😄
    The Phpfastcache Team

@Geolim4
Copy link
Member

Geolim4 commented Mar 11, 2024

Hello,

You're may facing concurrency issue. Since the Files driver is slow and disk-dependent, I suggest you to change the driver to redis :)

@eharris2000
Copy link
Author

test_4.php is with memcached. I can create a separate issue if you would like. In that test, memcached is used. It doesn't throw a file error. However, getItemsByTag() does not return items that have been tagged. However, if you inspect the memcached cache with a second file, the files are there.

@Geolim4
Copy link
Member

Geolim4 commented Mar 11, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants