Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 4afdfee

Browse files
phaasthaJeztah
authored andcommitted
Fix gcplogs memory/connection leak
The cloud logging client should be closed when the log driver is closed. Otherwise dockerd will keep a gRPC connection to the logging endpoint open indefinitely. This results in a slow leak of tcp sockets (1) and memory (~200Kb) any time that a container using `--log-driver=gcplogs` is terminates. Signed-off-by: Patrick Haas <patrickhaas@google.com> (cherry picked from commit ef553e14a4e27fc479b9c8e94d76654ec67694fe) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: 74c0c5b7f1a90bead853e98c7f77936caffba8d2 Component: engine
1 parent 3a9689e commit 4afdfee

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

components/engine/daemon/logger/gcplogs/gcplogging.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func init() {
5353
}
5454

5555
type gcplogs struct {
56+
client *logging.Client
5657
logger *logging.Logger
5758
instance *instanceInfo
5859
container *containerInfo
@@ -169,6 +170,7 @@ func New(info logger.Info) (logger.Logger, error) {
169170
}
170171

171172
l := &gcplogs{
173+
client: c,
172174
logger: lg,
173175
container: &containerInfo{
174176
Name: info.ContainerName,
@@ -236,7 +238,7 @@ func (l *gcplogs) Log(m *logger.Message) error {
236238

237239
func (l *gcplogs) Close() error {
238240
l.logger.Flush()
239-
return nil
241+
return l.client.Close()
240242
}
241243

242244
func (l *gcplogs) Name() string {

0 commit comments

Comments
 (0)