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

Autodiscover memleak #41748

Merged
merged 7 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Fix a bug where log files are rotated on startup when interval is configured and rotateonstartup is disabled {issue}41894[41894] {pull}41895[41895]
- Fix setting unique registry for non beat receivers {issue}42288[42288] {pull}42292[42292]
- The Kafka output now drops events when there is an authorisation error {issue}42343[42343] {pull}42401[42401]
- Fix autodiscovery memory leak related to metadata of start events {pull}41748[41748]

*Auditbeat*

Expand Down
7 changes: 6 additions & 1 deletion libbeat/autodiscover/autodiscover.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ func (a *Autodiscover) handleStop(event bus.Event) bool {
updated = true
}

// Cleanup meta references for this eventID
for configHash := range a.configs[eventID] {
a.meta.Remove(configHash)
}

delete(a.configs, eventID)

return updated
Expand All @@ -304,7 +309,7 @@ func (a *Autodiscover) getMeta(event bus.Event) mapstr.M {
a.logger.Errorf("Got a wrong meta field for event %v", event)
return nil
}
return meta
return meta.Clone()
}

// getID returns the event "id" field string if present
Expand Down
Loading