Heyo, anyone here worked with multiple redis conne...
# cfml-general
l
Heyo, anyone here worked with multiple redis connections in lucee? We're getting some thread locks problems from the looks of it. Currently using Redis as our sessionStorage, and whilst adding a new redis connection to save other stuff to using CacheGet and CachePut, the sessionStorage isn't updated properly. Checking the value of my session from redis I see a bunch of java stacktrace with java.util.concurrent.locks.ReentrantLock and lucee.commons.collection.concurrent.ConcurrentHashMapNullSupport (which also appears in lucees scope.log ) Using google I found this little line:
Copy code
You might not know it, but Redis is actually single-threaded, which is how every command is guaranteed to be atomic. While one command is executing, no other command will run.
Is it this that's the problem? If so, what can I do?
s
We use Redis for session storage and application caching and have never run into this. I'd check to make sure you're using the most recent Lucee redis extension as there have been some updates over the last year. We also use Cachebox as our interface with Redis, which shouldn't really make a difference for this kind of thing, but I'm curious what you mean by 'adding a new redis connection' - we only have a couple actual Redis caches: the session storage cache and the object cache. They're initialized onApplicationStart and so we're never 'adding new ones' after that
l
'Adding a new separate cache' is what I meant. Sorry about the miswording.
I'll check for updates, see if that helps. Thanks!
seems like that did the trick. you saved me a lot of debugging. thanks!
z
yeah, we use Redis heavily at work, Micha has been doing a lot of work fine tuning it
a little hidden bonus feature in the #lucee redis extension is
<cfdistributedlock>
http://127.0.0.1:8888/lucee/doc/tags.cfm?item=cfdistributedlock which is like cflock but works in a cluster using redis
👍 3
l
One day later and the issue didn't actually go away. I've now noticed there is actually a serializeable issue rather than thread locks. The session handling works when the session only contains string values, but the case causing issues is when the session contains nested structs with arrays. Any thoughts? @zackster @sknowlton
z
did you try clearing redis?
l
yes, that's how I noticed the error
stuff that shouldn't have been in session ( from redis ) are still appearing
z
and cycled lucee?
m
Cycled? We're getting it on 3 different machines... Below is the first row of the error: "ERROR","http-nio-8888-exec-3","02/24/2022","114342","scope-context","lucee.runtime.exp.CatchBlockImpl$SpecialItem lucee.runtime.exp.NativeException: lucee.runtime.exp.CatchBlockImpl$SpecialItem
last row: java.io.NotSerializableException: lucee.runtime.exp.CatchBlockImpl$SpecialItem ... 61 more
l
Whenever this issue has occured ONCE, the scope.log continues spouting this error with every request,
s
I remember there was an issue with nested structs ages ago. https://luceeserver.atlassian.net/browse/LDEV-2396
That's not what you're getting though
l
is there any way to decrypt the value in redis so it's more readable than this (using CacheGet on my session)? This is by just using toString() on the first bytearray. if i can see which values are actually saved, it might help figuring out what's going wrong
s
Not AFAIK
l
I finally figured it out, I've been using session as dumping errors for easy access and it turns out that the cfcatch struct is not an actual struct, but a lucee.runtime.exp.CatchBlockImpl which is not serializeable. Hence redis not handling it
z
that's actually fixed in 5.3.9 i believe