Comments (7)
By the way, restarting my servlet container fixes the issue
from jedis.
Thanks for submitting this. Are you sharing Jedis between requests or you are opening a new one for every request?
from jedis.
I believe I am sharing Jedis instances between requests. I'm using a pool to obtain it.
Here is the spring config that creates the JedisPool and the CacheRepository. Because scope isn't specified, it defaults to singleton.
<bean id="jedisPool" class="redis.clients.jedis.JedisPool"
init-method="init">
<constructor-arg index="0" value="${redis.host}" />
</bean>
<bean class="com.tedpennings.blog.cache.redis.RedisCacheRepository">
<constructor-arg index="0" ref="jedisPool" />
<constructor-arg index="1" value="${redis.json.namespace}" />
<constructor-arg index="2" value="${redis.json.expiry}" />
</bean>
This issue looks very similar to the issue reported this morning on the google group. I don't think the casts are happening correctly in redis.clients.jedis.Connection
from jedis.
Make sure every request has a different Jedis instance.
If you use JedisPool, you should use getResource() from a request to get a Jedis instance and when finished call returnResource()
You shouldn't share Jedis instances between request because it is not thread safe and wasn't thought for that. You should use JedisPool, which is a thredsafe Jedis factory.
I believe the cast issues you are experiencing are because of sharing Jedis instances. So you call different commands from different threads on the same instance, which leads to trying to get different responses. If they are not executed in order, Jedis instance will be messed up.
I will document that over this weekend. Please let me know if it helped. And if you want realtime answers join the IRC channel.
from jedis.
Thanks, I'll give that a try. We should definitely put up a wiki page on this. I'm happy to contribute code once I get something working (hahaha)
from jedis.
It looks like that fixed it. I ended up using Spring's aspect support to reflectively supply a fresh Jedis instance before each method invocation and return it after. If you want, we could put it in a wiki since there have been a number of questions about this lately.
from jedis.
Great... so I just created a github wiki so everyone can add content. Would you mind adding this please?
http://github.com/xetorthio/jedis/wiki
Thanks a lot!
from jedis.
Related Issues (20)
- Tag tests per Redis environment (not version)
- Remove support for Redis unstable
- Integrate JUnit reporter in the CI, dorny/reporter
- Check tests that force Redis failover, maybe separate them
- Add pre-commit linting to the repo
- Check tests that are commented out
- Speed up slow tests, or separate them out in their own jobs
- Run parallel jobs
- Ensure local development can run tests easily
- Make tests idempotent
- redis.clients.jedis.exceptions.JedisConnectionException: Unexpected end of stream. - issue with jedis 5.1.0 HOT 4
- jedis subscription not listening to thread interrupted signal HOT 3
- Add support for CLUSTER LINKS command HOT 1
- Add support for HSCAN [NOVALUES]
- Add command filter for CLIENT KILL to support maximum age via [MAXAGE] option
- Support XREAD, XREADGROUP reading from last message of stream
- Supporting redis unstable commands
- [question]Does jedis support jdk21? HOT 2
- How to use RedisTimeSeriesCommands with jedis HOT 1
- Pipelined transaction-handling: watch + get & multi + set
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jedis.