-
Notifications
You must be signed in to change notification settings - Fork 31
Conversation
Graceful shutdown for Windows Service * Forgot a parameter * Fixes since it wasn't compiling for Windows
agent/main_windows.go
Outdated
close(exit) | ||
return | ||
default: | ||
elog.Error(1, fmt.Sprintf("unexpected control request #%d", c)) |
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.
As @LotharSee mentioned in #330. Should we log receiving unexpected control requests as errors since it's not causing any error in the agent? We don't want the user troubleshooting it if there is nothing wrong.
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.
Yup if they are not actual errors, no reason to scare the user for that.
If we things these make sense to be in the logs for debug/support purpose, then we should make then info
. Or warn
if we though our switch
was exhaustive.
Add compiled messages for event viewer Put runAgent() on goroutine (instead of vice/versa)
4ca2a57
to
38c9cff
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.
A concern about the graceful shutdown, probably we have to revert some changes?
agent/main_windows.go
Outdated
|
||
exit := make(chan struct{}) | ||
|
||
go runAgent(exit) |
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.
With the current implementation if the Agent runs in a goroutine it means that the control loop is the one that ends the process, "killing" all remaining go routines (so the agent). In our case, we start flushing Agent buffers when it receives the exit
signal, but since the control loop is faster to return, it's not deterministic if buffers are flushed or not. This means that our shutdown may not be graceful.
Probably we should revert to the other way around? 0feeba7#diff-0c5f36551698accfa0720833c46f618fR64
agent/main_windows.go
Outdated
time.Sleep(100 * time.Millisecond) | ||
changes <- c.CurrentStatus | ||
case svc.Stop, svc.Shutdown: | ||
elog.Info(0x40000006, ServiceName) |
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.
What is the meaning of these hex values used for logging ?
Implements trace agent as a windows service.