colin-si opened a new issue, #1436: URL: https://github.com/apache/servicecomb-service-center/issues/1436
**Describe the bug** kvstore/cache_kv.go中很多方法没有使用defer的方式来释放锁,可能会有死锁的风险 **To Reproduce** 如下代码可能 在获取锁之后若有执行异常则会崩掉,则全局锁则无法释放,造成死锁。  https://github.com/apache/servicecomb-service-center/blob/ce7afe04f5bcad594bede6204a37443bfa9c0a00/datasource/etcd/state/kvstore/cache_kv.go#L45C6-L45C6 https://github.com/apache/servicecomb-service-center/blob/ce7afe04f5bcad594bede6204a37443bfa9c0a00/datasource/etcd/state/kvstore/cache_kv.go#L55 https://github.com/apache/servicecomb-service-center/blob/ce7afe04f5bcad594bede6204a37443bfa9c0a00/datasource/etcd/state/kvstore/cache_kv.go#L62 https://github.com/apache/servicecomb-service-center/blob/ce7afe04f5bcad594bede6204a37443bfa9c0a00/datasource/etcd/state/kvstore/cache_kv.go#L69 https://github.com/apache/servicecomb-service-center/blob/ce7afe04f5bcad594bede6204a37443bfa9c0a00/datasource/etcd/state/kvstore/cache_kv.go#L76 https://github.com/apache/servicecomb-service-center/blob/ce7afe04f5bcad594bede6204a37443bfa9c0a00/datasource/etcd/state/kvstore/cache_kv.go#L82 https://github.com/apache/servicecomb-service-center/blob/ce7afe04f5bcad594bede6204a37443bfa9c0a00/datasource/etcd/state/kvstore/cache_kv.go#L95 **Expected behavior** 此处预期获取锁之后的执行逻辑无异常,及时把锁释放掉。 为了增强可靠性,可以通过defer的方式来释放锁。 **Platform And Runtime (please complete the following information):** Platform - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] Runtime - Version [e.g. Go 1.11] **Additional context** Add any other context about the problem here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
