summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-02-03 17:31:17 +0300
committerValery Piashchynski <[email protected]>2021-02-03 17:31:17 +0300
commit8eda5dc6f0f7e05d7b3d62e1861af05b49a2574a (patch)
treefae66ad49d2a4624a7caf45a5bf07d53e5c7d26f /plugins
parent20a1a5d2eb26090e0eef0e6772330ee2a52526fa (diff)
Fix memory leak in the Worker.go
Diffstat (limited to 'plugins')
-rw-r--r--plugins/informer/rpc.go1
-rw-r--r--plugins/server/plugin.go10
2 files changed, 8 insertions, 3 deletions
diff --git a/plugins/informer/rpc.go b/plugins/informer/rpc.go
index c036ae96..55a9832b 100644
--- a/plugins/informer/rpc.go
+++ b/plugins/informer/rpc.go
@@ -26,7 +26,6 @@ func (rpc *rpc) List(_ bool, list *[]string) error {
*list = append(*list, name)
}
rpc.log.Debug("list of services", "list", *list)
-
rpc.log.Debug("successfully finished List method")
return nil
}
diff --git a/plugins/server/plugin.go b/plugins/server/plugin.go
index 73ce71f7..18a3a316 100644
--- a/plugins/server/plugin.go
+++ b/plugins/server/plugin.go
@@ -140,7 +140,7 @@ func (server *Plugin) NewWorkerPool(ctx context.Context, opt pool.Config, env En
}
list := make([]events.Listener, 0, 1)
- list = append(list, server.collectPoolLogs)
+ list = append(list, server.collectEvents)
if len(listeners) != 0 {
list = append(list, listeners...)
}
@@ -201,7 +201,7 @@ func (server *Plugin) setEnv(e Env) []string {
return env
}
-func (server *Plugin) collectPoolLogs(event interface{}) {
+func (server *Plugin) collectEvents(event interface{}) {
if we, ok := event.(events.PoolEvent); ok {
switch we.Event {
case events.EventMaxMemory:
@@ -235,6 +235,9 @@ func (server *Plugin) collectPoolLogs(event interface{}) {
switch we.Event {
case events.EventWorkerError:
server.log.Error(we.Payload.(error).Error(), "pid", we.Worker.(worker.BaseProcess).Pid())
+ case events.EventWorkerStderr:
+ // TODO unsafe byte to string convertation
+ server.log.Debug("worker stderr", "pid", we.Worker.(worker.BaseProcess).Pid(), "message", string(we.Payload.([]byte)))
case events.EventWorkerLog:
server.log.Debug(strings.TrimRight(string(we.Payload.([]byte)), " \n\t"), "pid", we.Worker.(worker.BaseProcess).Pid())
}
@@ -248,6 +251,9 @@ func (server *Plugin) collectWorkerLogs(event interface{}) {
server.log.Error(we.Payload.(error).Error(), "pid", we.Worker.(worker.BaseProcess).Pid())
case events.EventWorkerLog:
server.log.Debug(strings.TrimRight(string(we.Payload.([]byte)), " \n\t"), "pid", we.Worker.(worker.BaseProcess).Pid())
+ case events.EventWorkerStderr:
+ // TODO unsafe byte to string convertation
+ server.log.Debug("worker stderr", "pid", we.Worker.(worker.BaseProcess).Pid(), "message", string(we.Payload.([]byte)))
}
}
}