-
Notifications
You must be signed in to change notification settings - Fork 696
add timeout to cloud init progress monitoring #3904
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
add timeout to cloud init progress monitoring #3904
Conversation
9a5bf59
to
4c19c9a
Compare
@@ -292,6 +300,17 @@ func (a *HostAgent) emitEvent(_ context.Context, ev events.Event) { | |||
} | |||
} | |||
|
|||
func (a *HostAgent) emitCloudInitProgressEvent(ctx context.Context, progress *events.CloudInitProgress) { | |||
a.statusMu.RLock() | |||
currentStatus := a.currentStatus |
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.
👍🏻
4c19c9a
to
38e2c38
Compare
pkg/hostagent/hostagent.go
Outdated
defer func() { | ||
if cmd.Process != nil { | ||
logrus.Debug("Cleaning up cloud-init monitoring process") | ||
cmd.Process.Kill() |
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.
This code will never be executed because it won't reach here until the tail
process stops in the VM.
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.
Fixed it
olalekanodukoya@lima-defaultz:/Users/olalekanodukoya/works/opensource/lima$ ps aux | grep tail
olaleka+ 1704 33.3 0.0 6672 1920 pts/0 S+ 06:49 0:00 grep --color=auto tail
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.
confirmed that ssh
process for tail
killed. 👍
38e2c38
to
94933aa
Compare
Signed-off-by: olalekan odukoya <odukoyaonline@gmail.com>
94933aa
to
3f8402c
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.
LGTM! 👍🏻
However, I am concerned that the strings passed to exitReason
and Warn()
are the same.
Is there a mechanism for Golang to automatically optimize the use of the same string?
AFIK, It does. When the Go compiler sees the same string literal (e.g., "Failed to create stdout pipe for cloud-init monitoring") multiple times in the source code, it doesn’t generate a new copy of that string every time. Instead, it puts one copy of that string in the program’s read-only data segment, and every usage just points to it. |
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.
Thank you for letting me know that duplicate strings are optimized. 🙏🏻
LGTM!
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! 🙏🏻 |
fixes issue