Skip to content

Commit

Permalink
Fix data race accessing watched containers (#5310)
Browse files Browse the repository at this point in the history
(cherry picked from commit f769d20)
  • Loading branch information
exekias authored and ruflin committed Oct 4, 2017
1 parent 083d772 commit b13df81
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ https://github.com/elastic/beats/compare/v6.0.0-rc1...master[Check the HEAD diff

*Affecting all Beats*

- Fix data race accessing watched containers. {issue}5147[5147]

*Auditbeat*

*Filebeat*
Expand Down
3 changes: 2 additions & 1 deletion libbeat/processors/add_docker_metadata/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ func NewWatcherWithClient(client Client, cleanupTimeout time.Duration) (*watcher
func (w *watcher) Container(ID string) *Container {
w.RLock()
container := w.containers[ID]
_, ok := w.deleted[ID]
w.RUnlock()

// Update last access time if it's deleted
if _, ok := w.deleted[ID]; ok {
if ok {
w.Lock()
w.deleted[ID] = time.Now()
w.Unlock()
Expand Down

0 comments on commit b13df81

Please sign in to comment.