open-nomad/client
Mahmood Ali c86cff02f9 logmon: Fix a memory leak on task restart
Fix a logmon leak causing high goroutine and memory usage when a task
restarts.

Logmon `FileRotator` buffers the task stdout/stderr streams and
periodically flushing them to log files. Logmon creates a new
FileRotator for each stream for each task run. However, the
`flushPeriodically` goroutine is leaked when a task restarts,
holding a reference to a no-longer-needed `FileRotator` instance
along with its 64kb buffer.

The cause is that the code assumed `time.Ticker.Stop()` closes the
ticker channel, thereby terminating the goroutine, but the documentation
says otherwise:

> Stop turns off a ticker. After Stop, no more ticks will be sent. Stop does not close the channel, to prevent a concurrent goroutine reading from the channel from seeing an erroneous "tick".
https://pkg.go.dev/time#Ticker.Stop
2021-10-05 12:11:53 -04:00
..
allocdir gofmt all the files 2021-10-01 10:14:28 -04:00
allochealth e2e test for on_update service checks 2021-02-08 08:32:40 -05:00
allocrunner gofmt all the files 2021-10-01 10:14:28 -04:00
allocwatcher gofmt all the files 2021-10-01 10:14:28 -04:00
config client: add NOMAD_LICENSE to default env deny list 2021-09-21 13:51:17 -07:00
consul consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
devicemanager Fix some errcheck errors (#9811) 2021-01-14 12:46:35 -08:00
dynamicplugins Add gosimple linter (#9590) 2020-12-09 11:05:18 -08:00
fingerprint gofmt all the files 2021-10-01 10:14:28 -04:00
interfaces
lib gofmt all the files 2021-10-01 10:14:28 -04:00
logmon logmon: Fix a memory leak on task restart 2021-10-05 12:11:53 -04:00
pluginmanager gofmt all the files 2021-10-01 10:14:28 -04:00
servers
state gofmt all the files 2021-10-01 10:14:28 -04:00
stats deps: bump gopsutil to v3.21.2 2021-03-30 16:02:51 -04:00
structs CSI ListSnapshots secrets implementation 2021-07-28 11:30:29 -07:00
taskenv client: task env vars should take precendece over host env vars. 2021-09-20 09:15:28 +01:00
testutil client/ar: thread through cpuset manager 2021-04-13 13:28:36 -04:00
vaultclient Add gosimple linter (#9590) 2020-12-09 11:05:18 -08:00
acl.go
acl_test.go Event Stream: Track ACL changes, unsubscribe on invalidating changes (#9447) 2020-12-01 11:11:34 -05:00
agent_endpoint.go json handles were moved to a new package in #10202 2021-04-02 13:31:10 +00:00
agent_endpoint_test.go
alloc_endpoint.go client: fix multiple imports (#10537) 2021-05-13 14:30:31 -04:00
alloc_endpoint_test.go tests: remove duplicate import statements. 2021-06-11 09:39:22 +02:00
alloc_watcher_e2e_test.go
client.go lint: mark false positive or fix gocritic append lint errors. 2021-09-06 10:49:44 +02:00
client_stats_endpoint.go
client_stats_endpoint_test.go
client_test.go client: fix multiple imports (#10537) 2021-05-13 14:30:31 -04:00
csi_endpoint.go CSI: use AccessMode/AttachmentMode from CSIVolumeClaim 2021-04-07 11:24:09 -04:00
csi_endpoint_test.go CSI ListSnapshots secrets implementation 2021-07-28 11:30:29 -07:00
driver_manager_test.go
enterprise_client_oss.go gofmt all the files 2021-10-01 10:14:28 -04:00
fingerprint_manager.go
fingerprint_manager_test.go
fs_endpoint.go json handles were moved to a new package in #10202 2021-04-02 13:31:10 +00:00
fs_endpoint_test.go
gc.go chore: fix incorrect docstring formatting. 2021-08-30 11:08:12 +02:00
gc_test.go
heartbeatstop.go
heartbeatstop_test.go
node_updater.go
rpc.go pool: track usage of incoming streams (#10710) 2021-06-07 10:22:37 -04:00
rpc_test.go
testing.go test infrastructure for mock client RPCs (#10193) 2021-03-31 16:37:09 -04:00
util.go
util_test.go