Skip to content

Commit

Permalink
Handling better DeadlineExceeded errors from Docker API (elastic#15336)
Browse files Browse the repository at this point in the history
  • Loading branch information
rvillablanca authored and ChrsMark committed Jan 8, 2020
1 parent 7aee956 commit 7c562d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d

*Affecting all Beats*

- Add a friendly log message when a request to docker has exceeded the deadline. {pull}15336[15336]
- Decouple Debug logging from fail_on_error logic for rename, copy, truncate processors {pull}12451[12451]
- Add an option to append to existing logs rather than always rotate on start. {pull}11953[11953]
- Add `network` condition to processors for matching IP addresses against CIDRs. {pull}10743[10743]
Expand Down
9 changes: 7 additions & 2 deletions libbeat/common/docker/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,18 @@ func (w *watcher) watch() {

case err := <-errors:
// Restart watch call
logp.Err("Error watching for docker events: %v", err)
if err == context.DeadlineExceeded {
logp.Info("Context deadline exceeded for docker request, restarting watch call")
} else {
logp.Err("Error watching for docker events: %v", err)
}

time.Sleep(1 * time.Second)
break WATCH

case <-tickChan.C:
if time.Since(w.lastWatchReceivedEventTime) > dockerEventsWatchPityTimerTimeout {
logp.Info("No events received withing %s, restarting watch call", dockerEventsWatchPityTimerTimeout)
logp.Info("No events received within %s, restarting watch call", dockerEventsWatchPityTimerTimeout)
time.Sleep(1 * time.Second)
break WATCH
}
Expand Down

0 comments on commit 7c562d9

Please sign in to comment.