Skip to content

Conversation

@norio-nomura
Copy link
Contributor

By this change, limactl usernet can stop gracefully.

}

if err := osutil.SysKill(pid, osutil.SigKill); err != nil {
if err := osutil.SysKill(pid, osutil.SigInt); err != nil {
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Member

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)

@AkihiroSuda AkihiroSuda modified the milestones: v2.0.0, v2.0.1 Nov 6, 2025
break
}
if time.Since(startWaiting) > 5*time.Second {
logrus.Infof("usernet network still running after 5 seconds")
Copy link
Contributor Author

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>
@norio-nomura norio-nomura force-pushed the let-usernet-cleanup-on-exit branch from 9ab6051 to a392c0d Compare November 6, 2025 09:51
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda merged commit e769391 into lima-vm:master Nov 6, 2025
37 checks passed
@norio-nomura norio-nomura deleted the let-usernet-cleanup-on-exit branch November 6, 2025 15:14
@norio-nomura
Copy link
Contributor Author

Thanks! 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants