Skip to content
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

[Elastic Agent] Elastic Agent takes long to shut down #29650

Merged
merged 27 commits into from
Feb 14, 2022
Merged
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
undo typo fixes, they will be fixed on another PR
AndersonQ committed Jan 26, 2022
commit b7887e732ac1bccfb862f1b555a413872cd1d95a
4 changes: 2 additions & 2 deletions libbeat/common/backoff/equal_jitter.go
Original file line number Diff line number Diff line change
@@ -47,11 +47,11 @@ func NewEqualJitterBackoff(done <-chan struct{}, init, max time.Duration) Backof

// Reset resets the duration of the backoff.
func (b *EqualJitterBackoff) Reset() {
// Allow sleeping at least the init period on the first wait.
// Allow to sleep at least the init period on the first wait.
b.duration = b.init * 2
}

// Wait blocks until either the timer is completed or channel is done.
// Wait block until either the timer is completed or channel is done.
func (b *EqualJitterBackoff) Wait() bool {
// Make sure we have always some minimal back off and jitter.
temp := int64(b.duration / 2)
2 changes: 1 addition & 1 deletion libbeat/logp/configure/logging.go
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ func Logging(beatName string, cfg *common.Config) error {
return logp.Configure(config)
}

// LoggingWithOutputs builds a logp.Config based on the given common.Config and the specified
// Logging builds a logp.Config based on the given common.Config and the specified
// CLI flags along with the given outputs.
func LoggingWithOutputs(beatName string, cfg *common.Config, outputs ...zapcore.Core) error {
config := logp.DefaultConfig(environment)
2 changes: 1 addition & 1 deletion libbeat/logp/core.go
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ func Configure(cfg Config) error {
return ConfigureWithOutputs(cfg)
}

// ConfigureWithOutputs XXX: is used by elastic-agent only (See file: x-pack/elastic-agent/pkg/core/logger/logger.go).
// XXX: ConfigureWithOutputs is used by elastic-agent only (See file: x-pack/elastic-agent/pkg/core/logger/logger.go).
// The agent requires that the output specified in the config object is configured and merged with the
// logging outputs given.
func ConfigureWithOutputs(cfg Config, outputs ...zapcore.Core) error {
2 changes: 1 addition & 1 deletion x-pack/elastic-agent/magefile.go
Original file line number Diff line number Diff line change
@@ -508,7 +508,7 @@ func runAgent(env map[string]string) error {
return err
}

// docker does not exist for this commit, build it
// docker does not exists for this commit, build it
if !strings.Contains(dockerImageOut, tag) {
// produce docker package
packageAgent([]string{
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ var DefaultRK = "default"
// RoutingKey is used for routing as pipeline id.
type RoutingKey = string

// Router is an interface routing programs to the corresponding stream.
// Router is an interace routes programs to correspongind stream
type Router interface {
Routes() *sorted.Set
Route(id string, grpProg map[RoutingKey][]program.Program) error
Original file line number Diff line number Diff line change
@@ -54,7 +54,7 @@ func (m *manager) ReExec(shutdownCallback ShutdownCallbackFn, argOverrides ...st
if shutdownCallback != nil {
if err := shutdownCallback(); err != nil {
// panic; because there is no going back, everything is shutdown
panic(errors.New(errors.TypeUnexpected, err, "failure occurred during shutdown cleanup"))
panic(errors.New(errors.TypeUnexpected, err, "failure occured during shutdown cleanup"))
}
}

2 changes: 1 addition & 1 deletion x-pack/elastic-agent/pkg/core/server/server.go
Original file line number Diff line number Diff line change
@@ -581,7 +581,7 @@ func (as *ApplicationState) Stop(timeout time.Duration) error {
doneChan := as.checkinDone
as.checkinLock.RUnlock()
if (wasConn && doneChan == nil) || (!wasConn && s == proto.StateObserved_STOPPING && doneChan == nil) {
// either occurred:
// either occurred
// * client was connected then disconnected on stop
// * client was not connected; connected; received stopping; then disconnected
as.Destroy()
2 changes: 1 addition & 1 deletion x-pack/elastic-agent/pkg/core/status/reporter.go
Original file line number Diff line number Diff line change
@@ -279,7 +279,7 @@ func (r *reporter) Update(s state.Status, message string, payload map[string]int
}
}

// Unregister unregisters status from reporter. Reporter will no longer be taken into consideration
// Unregister unregister status from reporter. Reporter will no longer be taken into consideration
// for overall status computation.
func (r *reporter) Unregister() {
r.mx.Lock()