<@U06U0LB38> I think you have a race condition sit...
# cfwheels
@neokoenig I think you have a race condition situation here (https://github.com/cfwheels/cfwheels/blob/master/wheels/global/internal.cfm#L784-L785):
Copy code
public void function $addToCache(
    // ...
) {
    // ...
		for (local.key in application.wheels.cache[arguments.category]) {
			if (Now() > application.wheels.cache[arguments.category][local.key].expiresAt) {
Seems to me like there's no guarantee that
will still be there when you come to assume that it does.
(real world situation... we just got this error occurring)
I think the remediation here would be: • caching implementation code should be in a caching service, not in a general library file called "internal.cfm". Not just for the sake of pendantry, but to keep the code focused, controlled, and more testable. • access to the cache should be better controlled than this. Reads need to be read-locked; writes need to be exclusive-locked. • accessing
directly in implementation code is.. limiting.
should be wrapped in an adapter, and an instance of the adapter should be passed to the caching service. The current implementation is a bit... CF5.
NB: I am not at all bothered by this. We just shrugged and went "yeah we'll worry about this if it becomes a problem", so this is just FYI. I can raise a ticket in github if you like. I'll omit the last sentence from above if I do 😉