BLPOP works only sometimes

105 views
Skip to first unread message

Raghava Mutharaju

unread,
Sep 24, 2013, 4:19:54 AM9/24/13
to redi...@googlegroups.com
Hi,

I am using two separate Jedis instances. One instance is used for calling BLPOP (which gets blocked if the list is empty). Using the other Jedis instance (in a separate thread), I do an LPUSH on the same list. These two instances are run by separate threads.

Irrespective of whether BLPOP happens before or after LPUSH, sometimes, BLPOP does not pop out an element -- it continues to block and I can see an item in that list is available.
Sometimes it works fine.

I am using Redis-2.8.0-rc4. Any help is highly appreciated.

Regards,
Raghava.

Dvir Volk

unread,
Sep 24, 2013, 5:59:55 AM9/24/13
to redi...@googlegroups.com
Can you recreate it in a redis-cli? Can you make it happen with a stable redis 2.6?



--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/groups/opt_out.



--
Dvir Volk
Chief Architect, Everything.me

Raghava Mutharaju

unread,
Sep 24, 2013, 5:38:43 PM9/24/13
to redi...@googlegroups.com
No, I couldn't recreate it in redis-cli. It works fine in cli. When I used redis-2.6.16, it happens again but in some cases, even though the item is not in the list anymore BLPOP -- another Jedis does insert an item but BLPOP gets blocked with the item not in the list anymore.

I was using Redis for my application and thought I would use it for synchronization as well. Hence used BLPOP. Now, I moved to using java feature (CountDownLatch) and it works fine now. I guess I used it for the wrong purpose to begin with.

Regards,
Raghava.

Dvir Volk

unread,
Sep 25, 2013, 3:50:04 AM9/25/13
to redi...@googlegroups.com
Redis is perfect for distributed synchronization, it seems to me like it's either a bug in Jedis or a bug in your code. 
But as you said, you could not recreate it in pure redis, so it's not a redis issue. You might want to ask on the jedis mailing list.

Raghava Mutharaju

unread,
Sep 25, 2013, 10:56:23 AM9/25/13
to redi...@googlegroups.com
Ok, good to know that it is not uncommon to use Redis in that way :). Yes, I think it is most probably a bug in my code which isn't obvious. I will keep looking.

Thank you.

Regards,
Raghava.
Reply all
Reply to author
Forward
0 new messages