Skip to content

Commit

Permalink
Fix infinite failure on Kubernetes watch (elastic#6504)
Browse files Browse the repository at this point in the history
(cherry picked from commit a44818c)
  • Loading branch information
vjsamuel authored and Carlos Pérez-Aradros Herce committed Mar 12, 2018
1 parent e950869 commit 7d57a3f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ https://github.com/elastic/beats/compare/v6.2.2...6.2[Check the HEAD diff]
*Affecting all Beats*

- Avoid panic errors when processing nil Pod events in add_kubernetes_metadata. {issue}6372[6372]
- Fix infinite failure on Kubernetes watch {pull}6504[6504]

*Auditbeat*

Expand Down Expand Up @@ -262,6 +263,16 @@ https://github.com/elastic/beats/compare/v6.0.1...v6.1.0[View commits]
- Fix logstash output debug message. {pull}5799{5799]
- Fix isolation of modules when merging local and global field settings. {issue}5795[5795]
*Auditbeat*
- Add an error check to the file integrity scanner to prevent a panic when
there is an error reading file info via lstat. {issue}6005[6005]
- Fixed an issue where the proctitle value was being truncated.
- Fixed an issue where values were incorrectly interpretted as hex data.
- Fixed parsing of the `key` value when multiple keys are present.
- Fix possible resource leak if file_integrity module is used with config
reloading on Windows or Linux. {pull}6198[6198]
*Filebeat*
- Add support for adding string tags {pull}5395[5395]
Expand Down
15 changes: 6 additions & 9 deletions libbeat/common/kubernetes/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,17 +152,14 @@ func (p *podWatcher) watch() {
_, apiPod, err := watcher.Next()
if err != nil {
logp.Err("kubernetes: Watching API error %v", err)
watcher.Close()

// In case of EOF, stop watching and restart the process
if err == io.EOF || err == io.ErrUnexpectedEOF {
watcher.Close()
backoff(failures)
failures++
break
if !(err == io.EOF || err == io.ErrUnexpectedEOF) {
// This is an error event which can be recovered by moving to the latest resource verison
logp.Info("kubernetes: Ignoring event, moving to most recent resource version")
p.lastResourceVersion = ""
}

// Otherwise, this is probably an unknown event (unmarshal error), ignore it
continue
break
}

// Update last resource version and reset failure counter
Expand Down

0 comments on commit 7d57a3f

Please sign in to comment.