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

xPDOFileCache->get might return invalid data when use_flock is false #113

Open
uplex-lf opened this Issue Mar 10, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@uplex-lf
Copy link

uplex-lf commented Mar 10, 2017

Summary

I originally reported this in modxcms/revolution#13383. And there is also another issue mentioning another aspect of this bug at modxcms/revolution#12740.

I think I spotted a problem in xPDOFileCache while looking into a cache corruption issue on NFS for a customer:

xPDOFileCache->get always uses flock even when use_flock is false. Meanwhile xPDOCacheManager->writeFile which is used by xPDOFileCache->set honours use_flock and will use file based locking if use_flock is false.

Step to reproduce

n/a

Observed behavior

If use_flock is false cache files are read and their contents returned by get even when they are currently being (re)written.

Expected behavior

If use_flock is false xPDOFileCache->get should return null when the existence of a lockfile signals that a (re)write is in progress.

Environment

Originally MODX 2.5.5 but this issue is present in 2.x und 3.x branches of modxcms/xpdo.

@electrickite

This comment has been minimized.

Copy link
Contributor

electrickite commented Sep 29, 2017

This issue is affecting an environment I support as well. Specifically, a load balanced set of servers that share a common NFS mount. Would a PR that conforms to the expected behavior listed in this issue be accepted?

"If use_flock is false xPDOFileCache->get should return null when the existence of a lockfile signals that a (re)write is in progress."

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