Skip to content

Commit

Permalink
fix connection leak in the mongodb module (#5711) (#5742)
Browse files Browse the repository at this point in the history
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
(cherry picked from commit f9a18c1)
  • Loading branch information
ruflin authored and andrewkroh committed Nov 29, 2017
1 parent 8d3ba21 commit a64b4c7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ https://github.com/elastic/beats/compare/v6.0.0...master[Check the HEAD diff]
*Metricbeat*

- Fix map overwrite in docker diskio module. {issue}5582[5582]
- Fix connection leak in mongodb module. {issue}5688[5688]

*Packetbeat*

Expand Down
1 change: 1 addition & 0 deletions metricbeat/module/mongodb/dbstats/dbstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (m *MetricSet) Fetch() ([]common.MapStr, error) {
if err != nil {
return nil, err
}
defer mongoSession.Close()

// Get the list of databases names, which we'll use to call db.stats() on each
dbNames, err := mongoSession.DatabaseNames()
Expand Down
1 change: 1 addition & 0 deletions metricbeat/module/mongodb/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func (m *MetricSet) Fetch() (common.MapStr, error) {
if err != nil {
return nil, err
}
defer mongoSession.Close()

result := map[string]interface{}{}
if err := mongoSession.DB("admin").Run(bson.D{{Name: "serverStatus", Value: 1}}, &result); err != nil {
Expand Down

0 comments on commit a64b4c7

Please sign in to comment.