Skip to content

Commit

Permalink
Backport 3338 to the 5.2 branch (#3364)
Browse files Browse the repository at this point in the history
* Ensure harvesterCounter 8-byte alignment (#3273) (#3338)

harvesterCounter is accessed atomically and will fault on x86-32 or ARM
if not 8-byte aligned. See golang/go#599 for more details on why it
fails and https://golang.org/pkg/sync/atomic/#pkg-note-BUG for how
putting the field first in the struct fixes it.
(cherry picked from commit fd64af2)

* Follow up with changelog for 3338 (#3363)

(cherry picked from commit 03b70c3)
  • Loading branch information
tsg authored and ruflin committed Jan 13, 2017
1 parent fed391d commit c140992
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ https://github.com/elastic/beats/compare/v5.1.1...master[Check the HEAD diff]
*Filebeat*
- Fix registry cleanup issue when files falling under ignore_older after restart. {issue}2818[2818]
- Fix registry migration issue from old states were files were only harvested after second restart. {pull}3322[3322]
- Fix alignment issue were Filebeat compiled with Go 1.7.4 was crashing on 32 bits system. {issue}3273[3273]

*Winlogbeat*
- Fix for "The array bounds are invalid" error when reading large events. {issue}3076[3076]
Expand Down
3 changes: 2 additions & 1 deletion filebeat/prospector/prospector.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ var (
)

type Prospector struct {
// harvesterCount MUST be first field in struct. See https://github.com/golang/go/issues/599
harvesterCounter uint64 // Must be 8-byte aligned. Ensured if first field in struct
cfg *common.Config // Raw config
config prospectorConfig
prospectorer Prospectorer
Expand All @@ -30,7 +32,6 @@ type Prospector struct {
states *file.States
wg sync.WaitGroup
channelWg sync.WaitGroup // Separate waitgroup for channels as not stopped on completion
harvesterCounter uint64
}

type Prospectorer interface {
Expand Down

0 comments on commit c140992

Please sign in to comment.