nodejs 和 redis 以及socket.io搭建的聊天室,突然出了问题,大家帮帮我看看
发布于 8个月前 作者 iyangyi 1131 次浏览

昨天好好的,今天就突然出现问题了;

[root[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[@localhost](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)](/user/localhost)]# node index.js info - socket.io started debug - client authorized info - handshake authorized HdClXoYmdvMedmj_Zxz3 debug - setting request GET /socket.io/1/websocket/HdClXoYmdvMedmj_Zxz3 debug - set heartbeat interval for client HdClXoYmdvMedmj_Zxz3 debug - client authorized for debug - websocket writing 1:: node_redis: no callback to send error: ERR value is not a valid float

events.js:72 throw er; // Unhandled ‘error’ event ^ Error: ERR value is not a valid float at ReplyParser.<anonymous> (/home/web/chat/node_modules/redis/index.js:305:31) at ReplyParser.EventEmitter.emit (events.js:95:17) at ReplyParser.send_error (/home/web/chat/node_modules/redis/lib/parser/javascript.js:296:10) at ReplyParser.execute (/home/web/chat/node_modules/redis/lib/parser/javascript.js:181:22) at RedisClient.on_data (/home/web/chat/node_modules/redis/index.js:534:27) at Socket.<anonymous> (/home/web/chat/node_modules/redis/index.js:91:14) at Socket.EventEmitter.emit (events.js:95:17) at Socket.<anonymous> (stream_readable.js:746:14) at Socket.EventEmitter.emit (events.js:92:17) at emitReadable (_stream_readable.js:408:10)

找了半天也不知道是啥 原因。有遇到同样的问题或者知道的,求助。谢谢。

1 回复

问题已经解决。是redis 的 zadd 方法导致的。

msg_sender.zadd(socket.online_list, socket.level, socket.json_info); socket.level的值是从页面获取的到,当没传level时,socket.level变成了undefined。所有就报错了。 我也亲自在redis 客户端也试过了: redis 192.168.13.109:6380> zadd test undefined 33 (error) ERR value is not a valid float redis 192.168.13.109:6380>

谢谢。

回到顶部