webconsole: fix defer order to release zombie process

This commit is contained in:
wanyaoqi
2020-09-14 18:19:30 +08:00
parent ec769082ea
commit 4f8b80fcc1
2 changed files with 11 additions and 3 deletions
+7
View File
@@ -26,6 +26,7 @@ import (
"github.com/gorilla/mux"
"yunion.io/x/log"
"yunion.io/x/pkg/util/signalutils"
api "yunion.io/x/onecloud/pkg/apis/webconsole"
"yunion.io/x/onecloud/pkg/appsrv"
@@ -66,9 +67,15 @@ func StartService() {
common_options.StartOptionManager(opts, opts.ConfigSyncPeriodSeconds, api.SERVICE_TYPE, api.SERVICE_VERSION, o.OnOptionsChange)
registerSigTraps()
start()
}
func registerSigTraps() {
signalutils.SetDumpStackSignal()
signalutils.StartTrap()
}
func start() {
baseOpts := &o.Options.BaseOptions
// commonOpts := &o.Options.CommonOptions
+4 -3
View File
@@ -102,6 +102,10 @@ func (p *Pty) Resize(size *pty.Winsize) {
func (p *Pty) Stop() (err error) {
var errs []error
defer func() {
p.Cmd, p.Pty = nil, nil
}()
defer func() {
err = errors.NewAggregate(errs)
}()
@@ -139,8 +143,5 @@ func (p *Pty) Stop() (err error) {
}
}()
defer func() {
p.Cmd, p.Pty = nil, nil
}()
return
}