Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(agent): Handle signals and shutdown gracefully#5914

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mafredri merged 2 commits intomainfrommafredri/feat-handle-agent-signals
Jan 30, 2023

Conversation

mafredri
Copy link
Member

This change allows the agent to handle common shutdown signals like
interrupt, hangup and terminate and initiate a graceful shutdown.

As long as terraform providers initiate graceful shutdowns via the
aforementioned signals, things like SSH connections will be closed
immediately on shutdown instead of being left hanging/timing out due to
the agent being abruptly killed.

Refs:#4677,#5901

This change allows the agent to handle common shutdown signals likeinterrupt, hangup and terminate and initiate a graceful shutdown.As long as terraform providers initiate graceful shutdowns via theaforementioned signals, things like SSH connections will be closedimmediately on shutdown instead of being left hanging/timing out due tothe agent being abruptly killed.Refs:#4677,#5901
Comment on lines +57 to +62
logWriter := &lumberjack.Logger{
Filename: filepath.Join(os.TempDir(), "coder-agent-init.log"),
MaxSize: 5, // MB
}
defer logWriter.Close()
logger := slog.Make(sloghuman.Sink(cmd.ErrOrStderr()), sloghuman.Sink(logWriter)).Leveled(slog.LevelDebug)
Copy link
MemberAuthor

@mafredrimafredriJan 30, 2023
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This change might not actually be needed, but it feels safer than having both PID 1 and the forked process share an opened file.

mtojek reacted with thumbs up emoji
Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's sad that we can't put a unit test here in case somebody will try to refactor it in the future. Apart from this, LGTM.

@mafredrimafredri merged commitcf8d402 intomainJan 30, 2023
@mafredrimafredri deleted the mafredri/feat-handle-agent-signals branchJanuary 30, 2023 13:59
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJan 30, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@deansheatherdeansheatherdeansheather approved these changes

@mtojekmtojekmtojek approved these changes

@kylecarbskylecarbsAwaiting requested review from kylecarbs

Assignees

@mafredrimafredri

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@mafredri@deansheather@mtojek

[8]ページ先頭

©2009-2025 Movatter.jp