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
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
  • Loading branch information
adriansr authored and andrewkroh committed Jul 26, 2018
1 parent 14a3a5e commit 4843d6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ https://github.com/elastic/beats/compare/v6.2.3...master[Check the HEAD diff]
- Fixed parsing of AppArmor audit messages. {pull}6978[6978]
- Allow `auditbeat setup` to run without requiring elevated privileges for the audit client. {issue}7111[7111]
- Fix goroutine leak that occurred when the auditd module was stopped. {pull}7163[7163]
- Fixed a crash in the file_integrity module under Linux. {issue}7753[7753]

*Filebeat*

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 4843d6f

Please sign in to comment.