描写叙述:

redis client 2.0.0 pipeline 的list的rpop 存在严重bug,rpop list的时候,假设list已经为空的时候,rpop出来的Response依旧不为null,导致吊response.get()方法抛异常

代码:

  1. @Test
  2. public void testRedisPipeline(){
  3. Jedis jedis = null;
  4. try{
  5. jedis = new Jedis("127.0.0.1",6379);
  6. Pipeline pipelined = jedis.pipelined();
  7. for(int i=200;i<10000;i++){
  8. pipelined.lpush("aa", "val"+i);
  9. }
  10. pipelined.sync();
  11.  
  12. }catch(Exception e){
  13. e.printStackTrace();
  14. }finally{
  15. if(jedis!=null){
  16. jedis.disconnect();
  17. }
  18. }
  19. }
  1. <span style="white-space:pre"> </span>//这种方法会造成redis qps无限上升
  2. @Test
  3. public void testRedisPipelinePop(){
  4. Jedis jedis = null;
  5. try{
  6. List<Response<String>> result = new ArrayList<Response<String>>();
  7. jedis = new Jedis("127.0.0.1",6379);
  8. Pipeline pipelined = jedis.pipelined();
  9. for(int i=0;i<10;i++){
  10. //System.out.println(i);
  11. Response<String> rpop = pipelined.rpop("aa");
  12. //System.out.println(rpop);
  13. result.add(rpop);
  14. }
  15. pipelined.sync();
  16. //Response<Long> r = pipelined.bitcount("aa");
  17. for (Response<String> response : result) {
  18. System.out.println(response.get());//异常
  19. }
  20.  
  21. }catch(Exception e){
  22. e.printStackTrace();
  23. }finally{
  24. if(jedis!=null){
  25. jedis.disconnect();
  26. }
  27. }
  28. }

解决方法:

使用redis-cli 2.1.0以上版本号

redis client 2.0.0 pipeline 的list的rpop bug的更多相关文章

  1. [开源福利] FreeRedis 历时两年正式发布 v1.0 [C#.NET Redis Client]

    最近很多 .net QQ 群无故被封停,特别是 wpf 群几乎全军覆没.依乐祝的 .net6交流群,晓晨的 .net跨平台交流群,导致很多码友流离失所无家可归,借此机会使用一次召唤术,有需要的请加群: ...

  2. 鏈接Redis報錯`AUTH` failed: ERR Client sent AUTH, but no password is set [tcp://127.0.0.1:6379]

    問題 鏈接Redis報錯`AUTH` failed: ERR Client sent AUTH, but no password is set [tcp://127.0.0.1:6379] 解決 啟動 ...

  3. redis集群错误解决:/usr/lib/ruby/gems/1.8/gems/redis-3.0.0/lib/redis/client.rb:79:in `call': ERR Slot 15495 is already busy (Redis::CommandError)

    错误信息: /usr/lib/ruby/gems/1.8/gems/redis-3.0.0/lib/redis/client.rb:79:in `call': ERR Slot 15495 is al ...

  4. Redis 5.0.0 releases notes

    Redis 5.0 release notes ======================= ---------------------------------------------------- ...

  5. Redis 3.0.0 正式版出炉,高性能 K/V 服务

    Redis 3.0.0 正式版最终到来了,与 RC6 版本号比較.该版本号改进包含: * 修复了无磁盘的复制问题 (Oran Agra) * 在角色变化后对 BLPOP 复制进行測试 (Salvato ...

  6. Redis(1.5)Redis配置文件(4.0.14)

    4.0.14 常用配置 bind 127.0.0.1 # 默认绑定本地,不写的话任何地址都可以访问 protected-mode yes #保护模式,如果没有设置bind 配置地址,也没有设置任何密码 ...

  7. Redis 3.0.0 集群部署

    简述: 1.0.1:redis cluster的现状 目前redis支持的cluster特性 1):节点自动发现 2):slave->master 选举,集群容错 3):Hot reshardi ...

  8. 高屋建瓴 cocos2d-x-3.0架构设计 Cocos2d (v.3.0) rendering pipeline roadmap(原文)

    Cocos2d (v.3.0) rendering pipeline roadmap Why (the vision) The way currently Cocos2d does rendering ...

  9. failed (1113: No mapping for the Unicode character exists in the target multi-byte code page), client: 127.0.0.1...

    nginx部署网站后,访问域名,网页显示  500 Internal Server Error ,经查看发现nginx的error.log中有报错: failed (1113: No mapping ...

随机推荐

  1. dedecms:解析Robots.txt 协议标准

    Robots.txt 是存放在站点根目录下的一个纯文本文件.虽然它的设置很简单,但是作用却很强大.它可以指定搜索引擎蜘蛛只抓取指定的内容,或者是禁止搜索引擎蜘蛛抓取网站的部分或全部内容. 下面我们就来 ...

  2. JS高级——逻辑中断

    1.表达式1||表达式2:表达式1为真,返回表达式1:表达式1为假,返回表达式2 2.表达式1&&表达2:表达式1为真,返回表达式2:表达式1为假,返回表达式1

  3. JS——offset

    1.offsetWidth.offsetHeight返回盒子宽度和高度,包括padding与border,不包括margin 2.offsetLeft.offsetTop返回盒子距离定位盒子的x轴方向 ...

  4. (转) 分布式文件存储FastDFS(七)FastDFS配置文件详解

    http://blog.csdn.net/xingjiarong/article/details/50752586 配置FastDFS时,修改配置文件是很重要的一个步骤,理解配置文件中每一项的意义更加 ...

  5. codeforces_738D

    D. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  6. centos vm 桥接 --网络配置

    /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none BROADCAST=192.168.1.255 HWADDR= ...

  7. S-HR之时间空间配置

    <field name="entrys.bizDate"   dataType = "DATE"  label="生效日期" year ...

  8. win10如何进入安全模式的几种方法

    首先,说一下安全模式的作用: 安全模式, 用途有很多,常见的作用有以下几点 1. 电脑可能由于安装了某些驱动或者软件,不兼容导致电脑启动不了,可以进入安全模式卸载 2. 电脑中病毒之后,可以进入安全模 ...

  9. 第四节:numpy之数组排序

  10. STM32学习笔记:读写内部Flash(介绍+附代码)

    一.介绍 首先我们需要了解一个内存映射: stm32的flash地址起始于0x0800 0000,结束地址是0x0800 0000加上芯片实际的flash大小,不同的芯片flash大小不同. RAM起 ...