Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
client.go: HybridVSockDialer: Close dup fd after receive packet
Browse files Browse the repository at this point in the history
kata runtime jenkins-ci-ubuntu-1804-firecracker always failed when agent
of vendor is updated to new version in
#2285.

This test passed after added code to close dup fd after receive packet
in http://jenkins.katacontainers.io/job/kata-containers-runtime-ubuntu-1804-PR-firecracker/1339/.

Fixes: #703

Signed-off-by: Hui Zhu <teawater@antfin.com>
  • Loading branch information
teawater committed Dec 11, 2019
1 parent 8a4d901 commit 33f3208
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion protocols/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 33f3208

Please sign in to comment.