疑似memcached的一个小bug

栏目:Web开发 作者:admin 日期:2015-07-25 评论:0 点击: 3,579 次

最近发现一个memcached的报错:
++++ failed to close SockIO obj from deadPool
++++ socket or its streams already null in trueClose call
事情经过是这样的:
有个类A,在线上环境被序列化到了memcached。后来修改了A,变成了A+,发布到了线上环境。当从memcached缓存出对象之后,使用A+进行反序列化的时候,发生失败。报错信息如下:
[2015-01-23 10:42:59,770][116.56.138.83][noLogin] - ++++ exception thrown while trying to get object from cache for key: A-KEY
[2015-01-23 10:42:59,770][116.56.138.83][noLogin] - com.****.A; local class incompatible: stream classdesc serialVersionUID = 12345678, local class serialVersionUID = 1234569
[2015-01-23 10:43:01,690][][] - ++++ failed to close SockIO obj from deadPool
[2015-01-23 10:43:01,690][][] - ++++ socket or its streams already null in trueClose call
报错信息分析如下:
(1)++++ exception thrown while trying to get object from cache for key: A-KEY
说明反序列化出现问题
(2)com.****.A; local class incompatible: stream classdesc serialVersionUID = 12345678, local class serialVersionUID = 12345679
反序列化出现问题的原因是因为是serialVersionUID不兼容。
(3)++++ failed to close SockIO obj from deadPool
     ++++ socket or its streams already null in trueClose call
序列化失败之后,会关闭Socket(在sock.trueClose()方法里关闭的),这个被关闭的Socket会放入deadPool。自检线程去检查deadPool的时候,发现Socket已经关闭。所以会报错,报错的信息提示也很明确:
failed to close SockIO obj from deadPool:关闭deadPool中的SockIO失败
socket or its streams already null in trueClose call:SockIO或者其内部的stream在执行trueClose的时候已经置空了。
补充
自检程序:memcached启动的时候会启动一个自检程序,这个程序定期去检查连接池的连接情况,防止出现资源浪费,内存泄露等问题。

疑似memcached的一个小bug:等您坐沙发呢!

发表评论