Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: interrupt can close the log normally #134

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/backend/booster/bk_dist/executor/pkg/dist_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ func (d *DistExecutor) sysSignalHandler() {
select {
case sig := <-interrupt:
blog.Warnf("executor-command: get system signal %s, going to exit", sig.String())
blog.CloseLogs()

// catch control-C and should return code 130(128+0x2)
if sig == syscall.SIGINT {
Expand Down
4 changes: 3 additions & 1 deletion src/backend/booster/bk_dist/idleloop/command/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ func sysSignalHandler(cancel context.CancelFunc, _ *pkg.IdleLoop) {

p, err := process.NewProcess(int32(os.Getpid()))
if err == nil {
blog.Debugf("idelloop: ready kill children when recieved sinal")
blog.Debugf("idelloop: ready kill children when received signal")
// kill children
pkg.KillChildren(p)
}

blog.CloseLogs()

// catch control-C and should return code 130(128+0x2)
if sig == syscall.SIGINT {
os.Exit(130)
Expand Down
4 changes: 2 additions & 2 deletions src/backend/booster/bk_dist/idleloop/pkg/idleloop.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (l *IdleLoop) runCommitSuicideCheck(ctx context.Context) {
// // kill self
// _ = p.Kill()
// }
blog.Infof("booster: commit suicide for parent process %d not existed", l.ppid)
blog.Infof("idelloop: commit suicide for parent process %d not existed", l.ppid)
blog.CloseLogs()
os.Exit(0)
}
Expand All @@ -102,7 +102,7 @@ func (l *IdleLoop) runCommitSuicideCheck(ctx context.Context) {
// // kill self
// _ = p.Kill()
// }
blog.Infof("booster: commit suicide for grandfather process %d not existed", l.pppid)
blog.Infof("idelloop: commit suicide for grandfather process %d not existed", l.pppid)
blog.CloseLogs()
os.Exit(0)
}
Expand Down
2 changes: 2 additions & 0 deletions src/backend/booster/bk_dist/monitor/command/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func sysSignalHandler(cancel context.CancelFunc, _ *pkg.Monitor) {
// cancel context
cancel()

blog.CloseLogs()

// catch control-C and should return code 130(128+0x2)
if sig == syscall.SIGINT {
os.Exit(130)
Expand Down
2 changes: 2 additions & 0 deletions src/backend/booster/bk_dist/shadertool/command/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func sysSignalHandler(cancel context.CancelFunc, handle *pkg.ShaderTool) {
// handle.Clean()
handle.ReleaseResource()

blog.CloseLogs()

// catch control-C and should return code 130(128+0x2)
if sig == syscall.SIGINT {
os.Exit(130)
Expand Down
4 changes: 3 additions & 1 deletion src/backend/booster/bk_dist/ubttool/command/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ func sysSignalHandler(cancel context.CancelFunc, handle *pkg.UBTTool) {

select {
case sig := <-interrupt:
blog.Warnf("helptool: get system signal %s, going to exit", sig.String())
blog.Warnf("ubttool: get system signal %s, going to exit", sig.String())

// cancel handle's context and make sure that task is released.
cancel()

blog.CloseLogs()

// catch control-C and should return code 130(128+0x2)
if sig == syscall.SIGINT {
os.Exit(130)
Expand Down