Skip to content

The Beat agent control protocol client does not drain the Errors channel #34381

@cmacknz

Description

@cmacknz

The Beat agent control protocol client does not drain the client's Errors channel, which can cause the client to block if an error is encountered.

https://github.com/elastic/elastic-agent-client/blob/4477e3ace394ef1abfec55afa5cc5e1f6f87980c/pkg/client/client_v2.go#L86-L89

	// Errors returns channel of errors that occurred during communication.
	//
	// User of this client must read from this channel, or it will block the client.
	Errors() <-chan error

Likely this should be happening when we call Start()

// Start the config manager.
func (cm *BeatV2Manager) Start() error {
if !cm.Enabled() {
return fmt.Errorf("V2 Manager is disabled")
}
err := cm.client.Start(context.Background())
if err != nil {
return fmt.Errorf("error starting connection to client")
}
cm.client.RegisterDiagnosticHook("beat-rendered-config", "the rendered config used by the beat", "beat-rendered-config.yml", "application/yaml", cm.handleDebugYaml)
go cm.unitListen()
cm.isRunning = true
return nil
}

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions