diff --git a/protocols/client/client.go b/protocols/client/client.go index 7e8953ea20..43b9a94525 100644 --- a/protocols/client/client.go +++ b/protocols/client/client.go @@ -419,7 +419,9 @@ func HybridVSockDialer(sock string, timeout time.Duration) (net.Conn, error) { return nil, err } eot := make([]byte, 1) - if n, _, err := unix.Recvfrom(int(file.Fd()), eot, syscall.MSG_PEEK); err != nil || n == 0 { + n, _, err := unix.Recvfrom(int(file.Fd()), eot, syscall.MSG_PEEK) + file.Close() + if err != nil || n == 0 { conn.Close() if err == nil { err = io.EOF