-
Notifications
You must be signed in to change notification settings - Fork 721
pkg/networks/usernet: Use SIGINT instead of SIGKILL
#4310
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
pkg/networks/usernet: Use SIGINT instead of SIGKILL
#4310
Conversation
| } | ||
|
|
||
| if err := osutil.SysKill(pid, osutil.SigKill); err != nil { | ||
| if err := osutil.SysKill(pid, osutil.SigInt); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we fallback to SIGKILL on an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error there should only occur when the signal cannot be sent.
Process monitoring is required to fall back to SIGKILL.
Should process monitoring be included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go func(){ Sleep(3 * second); SysKill(pid, SigKill) }() may suffice, unless the PID is reused for another process within the 3 seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me postpone this PR to v2.0.1 (or later)
pkg/networks/usernet/recoincile.go
Outdated
| break | ||
| } | ||
| if time.Since(startWaiting) > 5*time.Second { | ||
| logrus.Infof("usernet network still running after 5 seconds") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can send SIGKILL here.
By this change, `limactl usernet` can stop gracefully. Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
9ab6051 to
a392c0d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
|
Thanks! 🙏🏻 |
By this change,
limactl usernetcan stop gracefully.