From 25212d3856bb3a6247dbb51201efcfe508955cc2 Mon Sep 17 00:00:00 2001 From: Adrian Serrano Date: Tue, 23 Jan 2018 19:19:36 +0700 Subject: [PATCH] Fix panic due to unaligned atomic uint64 access (#6148) There was a bug impacting 32-bit platforms where an atomic.Uint64 was not aligned to a 64 bit boundary, causing the log prospector to panic on startup. Instead of reordering the field to the start of the struct to guarantee alignment, which is brittle, this patch just changes the harvester limit to be a 32-bit unsigned integer. Closes #6145 (cherry picked from commit 9039cf78f7a161243c98468b0cdb3d3abd3e07a0) --- filebeat/prospector/log/config.go | 2 +- filebeat/prospector/log/prospector.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/filebeat/prospector/log/config.go b/filebeat/prospector/log/config.go index 50dbb6bacf5..e0a7284e40e 100644 --- a/filebeat/prospector/log/config.go +++ b/filebeat/prospector/log/config.go @@ -67,7 +67,7 @@ type config struct { Paths []string `config:"paths"` ScanFrequency time.Duration `config:"scan_frequency" validate:"min=0,nonzero"` CleanRemoved bool `config:"clean_removed"` - HarvesterLimit uint64 `config:"harvester_limit" validate:"min=0"` + HarvesterLimit uint32 `config:"harvester_limit" validate:"min=0"` Symlinks bool `config:"symlinks"` TailFiles bool `config:"tail_files"` RecursiveGlob bool `config:"recursive_glob.enabled"` diff --git a/filebeat/prospector/log/prospector.go b/filebeat/prospector/log/prospector.go index 1eba821c592..0ae11eedc00 100644 --- a/filebeat/prospector/log/prospector.go +++ b/filebeat/prospector/log/prospector.go @@ -46,7 +46,7 @@ type Prospector struct { outlet channel.Outleter stateOutlet channel.Outleter done chan struct{} - numHarvesters atomic.Uint64 + numHarvesters atomic.Uint32 } // NewProspector instantiates a new Log