Skip to content

Commit

Permalink
[8.12](backport #38407) Filebeat gcs input addFiledJobs panic protect…
Browse files Browse the repository at this point in the history
…ion (#38474)

* Filebeat gcs input addFiledJobs panic protection (#38407)

* Filebeat gcs input addFiledJobs panic protection

In case `obj, err := s.bucket.Object(name).Attrs(ctx)` return an error, obj will be probably `nil` in consequence the code below will panic
`objectURI := "gs://" + s.src.BucketName + "/" + obj.Name`

* Update CHANGELOG-developer.next.asciidoc

(cherry picked from commit c6fd99c)

* Update CHANGELOG-developer.next.asciidoc

---------

Co-authored-by: Adam Sowiński <[email protected]>
Co-authored-by: ShourieG <[email protected]>
  • Loading branch information
3 people authored Mar 21, 2024
1 parent 04bf860 commit 262ae24
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-developer.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ The list below covers the major changes between 7.0.0-rc2 and main only.
- Make winlogbeat/sys/wineventlog follow the unsafe.Pointer rules. {pull}36650[36650]
- Cleaned up documentation errors & fixed a minor bug in Filebeat Azure blob storage input. {pull}36714[36714]
- Fix copy arguments for strict aligned architectures. {pull}36976[36976]
- Fix filebeat gcs input panic {pull}38407[38407]

==== Added

Expand Down
1 change: 1 addition & 0 deletions x-pack/filebeat/input/gcs/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ func (s *scheduler) addFailedJobs(ctx context.Context, jobs []*job) []*job {
obj, err := s.bucket.Object(name).Attrs(ctx)
if err != nil {
s.log.Errorf("adding failed job %s to job list caused an error: %w", err)
continue
}

objectURI := "gs://" + s.src.BucketName + "/" + obj.Name
Expand Down

0 comments on commit 262ae24

Please sign in to comment.