[lxc-devel] [lxd/master] client: fix goroutine leak in ExecContainer

smibarber on Github lxc-bot at linuxcontainers.org
Wed Feb 13 03:47:44 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 459 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190212/ad5b8103/attachment.bin>
-------------- next part --------------
From e2379cf367ef76f1b42f5a747c475c18cbdf6cac Mon Sep 17 00:00:00 2001
From: Stephen Barber <smbarber at chromium.org>
Date: Tue, 12 Feb 2019 17:15:33 -0800
Subject: [PATCH] client: fix goroutine leak in ExecContainer

The stdin channel from WebsocketSendStream needs to be consumed,
otherwise that goroutine will leak.

Signed-off-by: Stephen Barber <smbarber at chromium.org>
---
 client/lxd_containers.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/client/lxd_containers.go b/client/lxd_containers.go
index b48a154336..0e3e1cd7a8 100644
--- a/client/lxd_containers.go
+++ b/client/lxd_containers.go
@@ -806,6 +806,7 @@ func (r *ProtocolLXD) ExecContainer(containerName string, exec api.ContainerExec
 
 				if fds["0"] != "" {
 					args.Stdin.Close()
+					<-dones[0]
 				}
 
 				for _, conn := range conns {


More information about the lxc-devel mailing list