????Bug?·?????Bug????·
????????????-Al ???????[ 2017/5/4 10:39:30 ] ?????????????????? ??????
??????Bug?·-????Bug
?????????????????Bug????????ó?(????/Э??)?????????????????????Щ????IO?????Bug?????????????????????д???????·?????????????????????????????????????
????????Bug???
??????ù???Redis???
???????????????????hget??hset??????Redis??壬?????????Redis??CPU??IO?д????????CPU??????????:
????CPU????????o??Redis??????????????????????????????readTimeOut?????????????????????hget??hset????kill????????????Redis??CPU???????
???????δ??????????
????????????????????????????????????????????????????????????????д?????Redis?????????????????????????????????????????key??????get User123456Name???????????redis????????OK??????????:
?????????????????????op??Redis?????????Key???delete????????????:
???????????????????????????????????????????????????????????????????????????????????????????10?????????????????????????????:
????????????????????????????????????????????????顣
??????????????????????????Okay??
????Bug????
???????Bug????Redis????Server???????????????Bug???????????Jedis???????Key????ò???????????????????????????????
??????СBug??Χ
????????:Redis?????t??????????????????????????Redis??????
???????:Redis?????key??Bug????????????????????????Okay??
????????:?????????????з??????????A???????????????A????json????(redis?????json)??
?????????????????????????????Redis?????????????????????A????????B????json??????
?????????????λ
??????????????Jedis??????????????t???????????????????????????????????????????Jedis?????????
??????????????????????δ???:
public Object invoke(Object proxy??Method method??Object[] args) throws Throwable{
JedisClient jedisClient = jedisPool.getResource();
try{
return method.invoke(jedisClient??args);
} catch(Exception e){
logger.error("invoke redis error"??e);
throw e;
}finally {
if(jedisClient != null){
// ?????????????
jedisPool.returnResource(jedisClient);
}
}
}
???????????ú????????????д?????????????????????н??????????????????Druid??????????????IO??fatal??????????????????????????jedisClient?????????о?????????????
????Bug????
?????????????????????????????????jedisClient????????в???????????????????????????????????????????????
???????????
????????????μ?redis????
????????Jedis???
????public String get(final String key) {
????checkIsInMulti();
????client.sendCommand(Protocol.Command.GET?? key);
????return client.getBulkReply();
????}
????Jedis?????????Bio?????????????????????:
????????????????redis????
????????Redis??????????????????????????command???????????readTimeOut????
?????????????????????3???
??????Redis??????????command???????????????command??socket????????inputream??buffer???????????command????????????
??????????inputStream?????и?????????????????????
???????????????????????????????????????????????
???????????????get user789Key?????get user456Key?????????????????????????????
?????????????
???????????????????ζ????????????μ??????????Redis?????????????????
???????get????????OK
?????????????????????????get????????OK??????????????????????set?????????????OK??get???????????????????????????
?????????????????????????????
????????????Redis????????????????????????????????????????????JedisClient????????+1???????????>3?????????????????????????????????????????????Bug????????????
????????ε???????????inputstream???з?
???????У????Redis????????????inputstream?????′ζ??????????????????
????????????????????
???????????IO?????????????????????????????檔
?????????Э????????????????
????????η??????????????????packetId??????????????????????packetId????????????????ν??????????????????е?packetId??????????packetId????????′??????:
????if(oldPacketId != packetIdFromData){
????throw new RuntimeException("????");
????}
???????
????????????????????????У?????IO???????????????????????????????????????????????socket????inputstream??buffer?е???????????????????????????
????????????????????Э?飬??????packetId????????????????μ??????????????????????????????????????????????????????Ч???????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11