Having an issue with ElastiCache Redis using Lucee...
# lucee
d
Having an issue with ElastiCache Redis using Lucee 5.3.9.166 extension 3.0.0.46 Running the following
Copy code
<cfquery name ="test" datasource="#mydsn#" tags="mytag" cachedwithin="#createTimespan(1,0,0,0)#">
    select * from myTable
</cfquery>
<cfscript>
    writedump(var=test, expand=false)
    cacheClear(filter=listToArray("mytag"),cachename= 'querycache')
</cfscript>
I get:
Copy code
lucee.runtime.exp.NativeException: java.lang.NullPointerException 
at lucee.runtime.cache.util.QueryTagFilter.accept(QueryTagFilter.java:27) 
at lucee.extension.io.cache.redis.CacheSupport.remove(CacheSupport.java:88) 
at lucee.runtime.functions.cache.CacheClear._call(CacheClear.java:111) 
at lucee.runtime.functions.cache.CacheClear.call(CacheClear.java:69) 
at dean_cfm$cf$i.call(/dean.cfm:3)
It only seems to happen with ElastiCache, if I use a local docker container, with the same Redis version, I dont get the error and the cacheClear removes the correct query from the cache. Happy to do more testing if someone can tell me why its throwing a NullPointerException in the QueryTagFilter.
Ive managed to replicate this thanks to our good friends at FusionReactor. Looks to be when an item is removed from the cache while the iterator is looping through the cache items looking for tagged items to remove. Ive replicated by pausing at
key = (String)it.next();
, removing an item from the cache, then stepping it to
while(filter != null && !filter.accept(entry));
where it throws. ElastiCache isnt the problem, its doing lots of cache invalidations from a fleet of servers constantly, so it's just a timing thing where one server is trying to invalidate a set of cache items and another server removes an item it is about to loop through. If I can figure out how to build the Redis extension I'll try push through a PR
This seems to have done the trick
z
nice digging, can you file a bug in jira?
to build the extension locally, just install and run ant in the root dir
d
All sorted, have a version in testing now 😁
can you still create a ticket so we can document it
d
Awesome! Nice work, ticket incoming…
z
cheers
I love a good bug report and a quick turnaround
❤️ 1