redis client 2.0.0 pipeline 的list的rpop bug
描写叙述:
redis client 2.0.0 pipeline 的list的rpop 存在严重bug,rpop list的时候,假设list已经为空的时候,rpop出来的Response依旧不为null,导致吊response.get()方法抛异常
代码:
@Test
public void testRedisPipeline(){
Jedis jedis = null;
try{
jedis = new Jedis("127.0.0.1",6379);
Pipeline pipelined = jedis.pipelined();
for(int i=200;i<10000;i++){
pipelined.lpush("aa", "val"+i);
}
pipelined.sync(); }catch(Exception e){
e.printStackTrace();
}finally{
if(jedis!=null){
jedis.disconnect();
}
}
}
<span style="white-space:pre"> </span>//这种方法会造成redis qps无限上升
@Test
public void testRedisPipelinePop(){
Jedis jedis = null;
try{
List<Response<String>> result = new ArrayList<Response<String>>();
jedis = new Jedis("127.0.0.1",6379);
Pipeline pipelined = jedis.pipelined();
for(int i=0;i<10;i++){
//System.out.println(i);
Response<String> rpop = pipelined.rpop("aa");
//System.out.println(rpop);
result.add(rpop);
}
pipelined.sync();
//Response<Long> r = pipelined.bitcount("aa");
for (Response<String> response : result) {
System.out.println(response.get());//异常
} }catch(Exception e){
e.printStackTrace();
}finally{
if(jedis!=null){
jedis.disconnect();
}
}
}
解决方法:
使用redis-cli 2.1.0以上版本号
redis client 2.0.0 pipeline 的list的rpop bug的更多相关文章
- [开源福利] FreeRedis 历时两年正式发布 v1.0 [C#.NET Redis Client]
		
最近很多 .net QQ 群无故被封停,特别是 wpf 群几乎全军覆没.依乐祝的 .net6交流群,晓晨的 .net跨平台交流群,导致很多码友流离失所无家可归,借此机会使用一次召唤术,有需要的请加群: ...
 - 鏈接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] 解決 啟動 ...
 - 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 ...
 - Redis 5.0.0 releases notes
		
Redis 5.0 release notes ======================= ---------------------------------------------------- ...
 - Redis 3.0.0 正式版出炉,高性能 K/V 服务
		
Redis 3.0.0 正式版最终到来了,与 RC6 版本号比較.该版本号改进包含: * 修复了无磁盘的复制问题 (Oran Agra) * 在角色变化后对 BLPOP 复制进行測试 (Salvato ...
 - Redis(1.5)Redis配置文件(4.0.14)
		
4.0.14 常用配置 bind 127.0.0.1 # 默认绑定本地,不写的话任何地址都可以访问 protected-mode yes #保护模式,如果没有设置bind 配置地址,也没有设置任何密码 ...
 - Redis 3.0.0 集群部署
		
简述: 1.0.1:redis cluster的现状 目前redis支持的cluster特性 1):节点自动发现 2):slave->master 选举,集群容错 3):Hot reshardi ...
 - 高屋建瓴 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 ...
 - 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 ...
 
随机推荐
- 使用GCD验证码倒计时
			
__block int timeout = 60; dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY ...
 - HashMap的尾部遍历问题--Tail Traversing
			
在看网上HashMap的resize()设计时,提到尾部遍历. JDK1.7的HashMap在实现resize()时,新table[]的列表采用LIFO方式,即队头插入.这样做的目的是:避免尾部遍 ...
 - Python初学1
			
windows版python下载: https://pan.baidu.com/s/1dsAPp0C9PJUF73kFDdAzXQ 安装时勾选pip和Add python.exe to Path. w ...
 - 关于 WebView 的一些笔记
			
什么是 WebView WebView 是手机中内置了一款高性能 webkit 内核浏览器,在 SDK 中封装的一个组件.没有提供地址栏和导航栏, WebView 只是单纯的展示一个网页界面.在开发中 ...
 - csf 课件转化为wmv正常格式
			
1. 下载csf文件到本地:如下图 2.从下面百度网盘下载到本地: https://pan.baidu.com/s/1BBbgq n85a 3.安装并出现下面图标,点击打开 4. 运行如下图 5. ...
 - java设计模式02观察者模式
			
观察者模式定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象.这个主题对象在状态上发生变化时,会通知所有观察者对象,使它们能够自动更新自己. 这里主要讲一下学习内置观察者的记录,在JA ...
 - java浅析
			
基本结构 1.以字节码的方式运行在虚拟机上,不是直接编译成机器码运行,所以性能上差于 C 但是高于 python这样的解释形语言. 笔者大学期间学习过 汇编和C,工作后使用python,对这两种语言有 ...
 - Python学习【第4篇】:Python之文件操作
			
文件操作 读取一行 f=open("D:\\1.txt",'rb') print f.readline() f.close() 将文件内容保存在一个list with open(& ...
 - 洛谷——P1759 通天之潜水
			
P1759 通天之潜水 题目背景 直达通天路·小A历险记第三篇 题目描述 在猴王的帮助下,小A终于走出了这篇荒山,却发现一条波涛汹涌的河拦在了自己的面前.河面上并没有船,但好在小A有n个潜水工具. ...
 - 第十节:numpy之数组文件操作
			
1.安装ipython 2.创建txt文件 3.直接上代码: