来自timer.Stop() 文档
停止阻止计时器开火。如果调用停止计时器,则返回true;如果计时器已过期或已停止,则返回false。停止不关闭通道,以防止从通道读取不正确成功。
我需要找到一种方法来摧毁定时器对象或通道在程序中创建通过之后或NewTimer。我不直接使用这些函数,只是使用这些函数实现超时的另一个库。我处理程序内存的请求越多,就会不断增加,然后就会被杀死。
我曾查过以下地方,但没有多少帮助:
请帮帮忙,急需解决这个问题。
更新
可疑代码在https://github.com/gocql/gocql/blob/986e33a705412161497203d55d0669d04282f5ff/conn.go#L546
var timeoutCh <-chan time.Time
if c.timeout > 0 {
timeoutCh = time.After(c.timeout)
}
select {
case err := <-call.resp:
if err != nil {
if !c.Closed() {
// if the connection is closed then we cant release the stream,
// this is because the request is still outstanding and we have
// been handed another error from another stream which caused the
// connection to close.
c.releaseStream(stream)
}
return nil, err
}
case <-timeoutCh:
close(call.timeout)
c.handleTimeout()
return nil, ErrTimeoutNoResponse
case <-c.quit:
return nil, ErrConnectionClosed
}我怎么知道这个?我运行go工具pprof来捕获memprof,它显示的是:

发布于 2016-02-20 15:47:26
我已经合并了一个修复程序,如果您遇到进一步的问题,https://github.com/gocql/gocql/pull/661请提出一个问题
https://stackoverflow.com/questions/35512541
复制相似问题