Skip to content

Commit

Permalink
proxy: increase connection write timeout
Browse files Browse the repository at this point in the history
We don't know how much time a container can be paused, hence connection
write timeout should be big enough to don't close the connection while
the container is paused.

fixes kata-containers/agent#231
fixes kata-containers#70

Signed-off-by: Julio Montes <[email protected]>
  • Loading branch information
Julio Montes committed May 17, 2018
1 parent 1641414 commit c7dc69b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const (
termSignal = syscall.SIGTERM
)

const year time.Duration = time.Hour * 24 * 365

var debug = false

// version is the proxy version. This variable is populated at build time.
Expand All @@ -43,7 +45,13 @@ var crashOnError = false
var proxyLog = logrus.New()

func serve(servConn io.ReadWriteCloser, proto, addr string, results chan error) (net.Listener, error) {
session, err := yamux.Client(servConn, nil)
sessionConfig := yamux.DefaultConfig()
sessionConfig.EnableKeepAlive = true
// 10 seconds is too early to suspect that a problem with the underlying connection has occurred.
// Since we don't know how much time a container can be paused let's set this timeout to 100 years,
// probably we won't be there when that occurs ;(
sessionConfig.ConnectionWriteTimeout = year * 100
session, err := yamux.Client(servConn, sessionConfig)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit c7dc69b

Please sign in to comment.