summaryrefslogtreecommitdiff
path: root/libpod/container_exec.go
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2020-03-25 15:33:52 -0400
committerMatthew Heon <mheon@redhat.com>2020-03-25 15:33:52 -0400
commit1313f8a4504000e43512810937701347bf252cfc (patch)
tree2c3bce783ac4416c03934d4c5a96e5b055cfa6fc /libpod/container_exec.go
parentff0124aee1ca700be3b7357b992a220cdacfddfd (diff)
downloadpodman-1313f8a4504000e43512810937701347bf252cfc.tar.gz
podman-1313f8a4504000e43512810937701347bf252cfc.tar.bz2
podman-1313f8a4504000e43512810937701347bf252cfc.zip
Ensure that exec sends resize events
We previously tried to send resize events only after the exec session successfully started, which makes sense (we might drop an event or two that came in before the exec session started otherwise). However, the start function blocks, so waiting actually means we send no resize events at all, which is obviously worse than losing a few.. Sending resizes before attach starts seems to work fine in my testing, so let's do that until we get bug reports that it doesn't work. Fixes #5584 Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod/container_exec.go')
-rw-r--r--libpod/container_exec.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/libpod/container_exec.go b/libpod/container_exec.go
index 7ed7a3343..6b88e5205 100644
--- a/libpod/container_exec.go
+++ b/libpod/container_exec.go
@@ -575,7 +575,7 @@ func (c *Container) ExecResize(sessionID string, newSize remotecommand.TerminalS
return errors.Wrapf(define.ErrNoSuchExecSession, "container %s has no exec session with ID %s", c.ID(), sessionID)
}
- logrus.Infof("Removing container %s exec session %s", c.ID(), session.ID())
+ logrus.Infof("Resizing container %s exec session %s to %+v", c.ID(), session.ID(), newSize)
if session.State != define.ExecStateRunning {
return errors.Wrapf(define.ErrExecSessionStateInvalid, "cannot resize container %s exec session %s as it is not running", c.ID(), session.ID())
@@ -592,9 +592,6 @@ func (c *Container) Exec(config *ExecConfig, streams *AttachStreams, resize <-ch
if err != nil {
return -1, err
}
- if err := c.ExecStartAndAttach(sessionID, streams); err != nil {
- return -1, err
- }
// Start resizing if we have a resize channel.
// This goroutine may likely leak, given that we cannot close it here.
@@ -605,6 +602,7 @@ func (c *Container) Exec(config *ExecConfig, streams *AttachStreams, resize <-ch
// session.
if resize != nil {
go func() {
+ logrus.Debugf("Sending resize events to exec session %s", sessionID)
for resizeRequest := range resize {
if err := c.ExecResize(sessionID, resizeRequest); err != nil {
// Assume the exec session went down.
@@ -615,6 +613,10 @@ func (c *Container) Exec(config *ExecConfig, streams *AttachStreams, resize <-ch
}()
}
+ if err := c.ExecStartAndAttach(sessionID, streams); err != nil {
+ return -1, err
+ }
+
session, err := c.ExecSession(sessionID)
if err != nil {
return -1, err