8000 Fix gcplogs memory/connection leak · thaJeztah/docker@ef553e1 · GitHub
[go: up one dir, main page]

Skip to content

Commit ef553e1

Browse files
committed
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>
1 parent 46cdcd2 commit ef553e1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

daemon/logger/gcplogs/gcplogging.go

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

5656
type gcplogs struct {
57+
client *logging.Client
5758
logger *logging.Logger
5859
instance *instanceInfo
5960
container *containerInfo
@@ -170,6 +171,7 @@ func New(info logger.Info) (logger.Logger, error) {
170171
}
171172

172173
l := &gcplogs{
174+
client: c,
173175
logger: lg,
174176
container: &containerInfo{
175177
Name: info.ContainerName,
@@ -237,7 +239,7 @@ func (l *gcplogs) Log(m *logger.Message) error {
237239

238240
func (l *gcplogs) Close() error {
239241
l.logger.Flush()
240-
return nil
242+
return l.client.Close()
241243
}
242244

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

0 commit comments

Comments
 (0)
0