Cache pulls non-deterministically return a live object ref to some "other" object #13
Open
Description
David @ inLeague was investigating some strange behavior where redis cache gets were producing objects we'd pulled on previous requests, modified in Lucee, but then not written back to the cache, and he found the following. This occurs either with direct redis interaction or with Cachebox.
It seems pulling from cache will non-deterministically return a live object ref to some object elsewhere in the program:
function directlyUseRedis() {
var someObj = {value: 42}
var someKey = "someKey-devdevdev-justredis"
cachePut(
someKey,
someObj,
createTimeSpan( 9, 9, 9, 9 ),
createTimeSpan( 9, 9, 9, 9 ),
"default"
)
var x = cacheGet(cacheName="default", id=someKey);
// sometimes the cached source and cached origin object are exactly the same, maybe 33% of the time
return {isSame_redis: x === someObj}
}
function useCachebox() {
var someObj = {value: 42}
var someKey = "someKey-devdevdev-cbox"
var objectCache = getInstance("cachebox:object")
objectCache.set( someKey, someObj );
var x = objectCache.get( someKey );
return {isSame_cachebox: x === someObj};
}
function doit() {
redis = []
cachebox = []
for (i = 0; i < 10; ++i) {
cachebox.append(useCachebox());
redis.append(directlyUseRedis());
}
writedump(redis);
writedump(cachebox)
}
doit();
abort;
Redis driver: 3.0.0.48
Lucee: 5.3.10.120
We did not notice this until we upgraded from 3.0.0.47, but the specific kind of interaction going on here doesn't happen a ton with us so that may be a red herring.
Metadata
Assignees
Labels
No labels