Skip to content

Commit

Permalink
Protect against nil errors from inotify (elastic#7753) (elastic#7754) (
Browse files Browse the repository at this point in the history
…elastic#7756)

Users are experiencing occasional crashes in auditbeat that are caused
by a nil error being printed to the logs. Adding some defensive code to
prevent auditbeat from panicking.

Fixes elastic#7753

(cherry picked from commit 4843d6f)
  • Loading branch information
adriansr authored and andrewkroh committed Jul 27, 2018
1 parent a3594a6 commit 2a398dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ https://github.com/elastic/beats/compare/v6.4.0...6.4[Check the HEAD diff]

*Auditbeat*

- Fixed a crash in the file_integrity module under Linux. {issue}7753[7753]

*Filebeat*

*Heartbeat*
Expand Down
6 changes: 5 additions & 1 deletion auditbeat/module/file_integrity/eventreader_fsnotify.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ func (r *reader) consumeEvents(done <-chan struct{}) {

r.eventC <- e
case err := <-r.watcher.ErrorChannel():
r.log.Warnw("fsnotify watcher error", "error", err)
// a bug in fsnotify can cause spurious nil errors to be sent
// on the error channel.
if err != nil {
r.log.Warnw("fsnotify watcher error", "error", err)
}
}
}
}
Expand Down

0 comments on commit 2a398dc

Please sign in to comment.