mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vminsert/netstorage: make sure the conn exists before closing it in storageNode.closeBrokenConn
The conn can be missing or already closed during the call to storageNode.closeBrokenConn. Prevent `nil pointer dereference` panic by verifying whether the conn is already closed. Thanks to @CH-anhngo for reporting the issue. Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/189
This commit is contained in:
parent
c64fb91a43
commit
73ac7b8dd6
1 changed files with 3 additions and 0 deletions
|
@ -167,6 +167,9 @@ func (sn *storageNode) dial() error {
|
|||
}
|
||||
|
||||
func (sn *storageNode) closeBrokenConn() {
|
||||
if sn.bc == nil {
|
||||
return
|
||||
}
|
||||
_ = sn.bc.Close()
|
||||
sn.bc = nil
|
||||
sn.connectionErrors.Inc()
|
||||
|
|
Loading…
Reference in a new issue