gresrun / jesque

An implementation of Resque in Java.
http://gresrun.github.io/jesque
Apache License 2.0
628 stars 131 forks source link

Throw JedisDataException when enqueue a job #150

Open Kiennh opened 6 years ago

Kiennh commented 6 years ago

Some time, i got this error when enqueue job. After few minus, everything will back to normal, job can enqueue agian, I don't now where to start to debug this job, plz help

redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holding the wrong kind of value 5 at redis.clients.jedis.Protocol.processError(Protocol.java:127) ~[delivery-2.0.jar:?] 6 at redis.clients.jedis.Protocol.process(Protocol.java:161) ~[delivery-2.0.jar:?] 7 at redis.clients.jedis.Protocol.read(Protocol.java:215) ~[delivery-2.0.jar:?] 8 at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340) ~[delivery-2.0.jar:?] 9 at redis.clients.jedis.Connection.getIntegerReply(Connection.java:265) ~[delivery-2.0.jar:?] 10 at redis.clients.jedis.Jedis.rpush(Jedis.java:865) ~[delivery-2.0.jar:?] 11 at net.greghaines.jesque.client.AbstractClient.doEnqueue(AbstractClient.java:178) ~[delivery-2.0.jar:?] 12 at net.greghaines.jesque.client.ClientPoolImpl$1.doWork(ClientPoolImpl.java:62) ~[delivery-2.0.jar:?] 13 at net.greghaines.jesque.client.ClientPoolImpl$1.doWork(ClientPoolImpl.java:56) ~[delivery-2.0.jar:?] 14 at net.greghaines.jesque.utils.PoolUtils.doWorkInPool(PoolUtils.java:52) ~[delivery-2.0.jar:?] 15 at net.greghaines.jesque.client.ClientPoolImpl.doEnqueue(ClientPoolImpl.java:56) ~[delivery-2.0.jar:?] 16 at net.greghaines.jesque.client.AbstractClient.enqueue(AbstractClient.java:77) ~[delivery-2.0.jar:?]

UriahOssin commented 3 years ago

I just came across the exact same issue.

The problem in my case was that the same queue was used both for delayed messaging and also for regular messaging. Due to the fact each messaging method uses a different data structure in Redis, data type collision is quick to happen when trying to enqueue a regular message while a delayed message is still there.

Obvious solution is of course to use a different queue name for each messaging method.