Closed songliwei2014 closed 7 years ago
新的版本还不稳定,建议用v1.0
你最近有时间修复这个crash吗?看了你的v1.0 是很早之前的版本了。仔细看了你的ssdbclient.go 没有发现明显逻辑异常,对比了原生了C++driver,解包的时候,是否是对错误情况处理还不好呢?比如读取出错,返回了一个Err之后,其实并没有立即关闭连接,也没有清空接受缓冲区,那下次使用时,得到的响应必然不是当前这次命令的响应了。
能否加你微信呢?我给你的邮箱发送了邮件,可以直接回复给我。后面可以继续探讨。
正在测试新的代码,但逻辑上没有太大的出入。
给你回了邮件。
已解决
更新到你的最新版本之后直接崩溃了, 请问当前可以直接使用的是什么版本呢?TagV1.0吗? | // ReadSlice reads until the first occurrence of delim in the input, | // returning a slice pointing at the bytes in the buffer. | // The bytes stop being valid at the next read. | // If ReadSlice encounters an error before finding a delimiter, | // it returns all the data in the buffer and the error itself (often io.EOF). | // ReadSlice fails with error ErrBufferFull if the buffer fills without a delim. | // Because the data returned from ReadSlice will be overwritten | // by the next I/O operation, most clients should use | // ReadBytes or ReadString instead. | // ReadSlice returns err != nil if and only if line does not end in delim.
goroutine 996 [running]: panic: runtime error: slice bounds out of range
bufio.(Reader).ReadSlice(0xc42006ed20, 0xc42004550a, 0x453567, 0xc4200458f0, 0x42ca84, 0xc420045588, 0x452bb0) /usr/local/go/src/bufio/bufio.go:316 +0x258 bufio.(Reader).ReadBytes(0xc42006ed20, 0xc420468b0a, 0xc420468b70, 0x0, 0x0, 0xc4200459c8, 0x55f8af) /usr/local/go/src/bufio/bufio.go:416 +0x66 github.com/seefan/gossdb.(SSDBClient).Recv(0xc4200f16b0, 0xc420045950, 0x3, 0x3, 0x0, 0x0) /root/go/src/github.com/seefan/gossdb/ssdbclient.go:196 +0x8a github.com/seefan/gossdb.(SSDBClient).do(0xc4200f16b0, 0xc420045950, 0x3, 0x3, 0x0, 0xc4200457d8, 0x410c32, 0xc42021e1b0, 0x10) /root/go/src/github.com/seefan/gossdb/ssdbclient.go:60 +0x9c github.com/seefan/gossdb.(SSDBClient).Do(0xc4200f16b0, 0xc420045950, 0x3, 0x3, 0x40eb9f, 0x683e60, 0xc42021e1b0, 0xc420045900, 0xc42021e1b0) /root/go/src/github.com/seefan/gossdb/ssdbclient.go:80 +0x74 github.com/seefan/gossdb.(Client).Do(0xc42000d580, 0xc420045950, 0x3, 0x3, 0x0, 0xc4200458b0, 0x4b0088, 0xc4200b0040, 0x54003d) /root/go/src/github.com/seefan/gossdb/client.go:46 +0x50 github.com/seefan/gossdb.(*Client).Hget(0xc42000d580, 0xc42021e184, 0xc, 0x70c9e5, 0x1, 0xc, 0xc420045a18, 0xc4200f3a20, 0xc42021e184) /root/go/src/github.com/seefan/gossdb/hset.go:30 +0x184