Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.13](backport #38407) Filebeat gcs input addFiledJobs panic protection #38475

Merged
merged 2 commits into from
Mar 21, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Mar 20, 2024

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

Proposed commit message

Filebeat gcs input addFiledJobs panic protection

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

No idea

How to test this PR locally

No idea

Related issues

No idea

Use cases

No idea

Screenshots

Logs

Input crashed with: input panic with: runtime error: invalid memory address or nil pointer dereference
goroutine 938 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x65
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor.(*managedInput).runSource.func1()
	github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go:143 +0x5d
panic({0x558d0f92f8a0, 0x558d123846f0})
	runtime/panic.go:884 +0x213
github.com/elastic/beats/v7/x-pack/filebeat/input/gcs.(*scheduler).addFailedJobs(0xc002e6cb40, {0x558d1007a820, 0xc002e720a0}, {0xc0042de240, 0x3, 0x4})
	github.com/elastic/beats/v7/x-pack/filebeat/input/gcs/scheduler.go:238 +0x378
github.com/elastic/beats/v7/x-pack/filebeat/input/gcs.(*scheduler).scheduleOnce(0xc002e6cb40, {0x558d1007a820?, 0xc002e720a0})
	github.com/elastic/beats/v7/x-pack/filebeat/input/gcs/scheduler.go:106 +0x2d3
github.com/elastic/beats/v7/x-pack/filebeat/input/gcs.(*scheduler).schedule(0xc002e6cb40, {0x558d1007a820?, 0xc002e720a0})
	github.com/elastic/beats/v7/x-pack/filebeat/input/gcs/scheduler.go:60 +0x65
github.com/elastic/beats/v7/x-pack/filebeat/input/gcs.(*gcsInput).Run(_, {0xc006f6a490, {0xc002e70000, 0x86}, {{0x558d0eae5cfe, 0x8}, {0x558d0eae5cfe, 0x8}, {0x558d0eadf24e, 0x6}, ...}, ...}, ...)
	github.com/elastic/beats/v7/x-pack/filebeat/input/gcs/input.go:183 +0x885
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor.(*managedInput).runSource(_, {0xc006f6a490, {0xc002e70000, 0x86}, {{0x558d0eae5cfe, 0x8}, {0x558d0eae5cfe, 0x8}, {0x558d0eadf24e, 0x6}, ...}, ...}, ...)
	github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go:168 +0x479
github.com/elastic/beats/v7/filebeat/input/v2/input-cursor.(*managedInput).Run.func1()
	github.com/elastic/beats/v7/filebeat/input/v2/input-cursor/input.go:122 +0x1bf
github.com/elastic/go-concert/unison.(*MultiErrGroup).Go.func1()
	github.com/elastic/go-concert@v0.2.0/unison/multierrgroup.go:42 +0x75
created by github.com/elastic/go-concert/unison.(*MultiErrGroup).Go
	github.com/elastic/go-concert@v0.2.0/unison/multierrgroup.go:40 +0x8d

This is an automatic backport of pull request #38407 done by [Mergify](https://mergify.com).

* 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)
@mergify mergify bot requested a review from a team as a code owner March 20, 2024 14:18
@mergify mergify bot added the backport label Mar 20, 2024
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Mar 20, 2024
@botelastic
Copy link

botelastic bot commented Mar 20, 2024

This pull request doesn't have a Team:<team> label.

@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 20, 2024

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Duration: 138 min 9 sec

❕ Flaky test report

No test was executed to be analysed.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@ShourieG ShourieG merged commit f61ce27 into 8.13 Mar 21, 2024
21 checks passed
@ShourieG ShourieG deleted the mergify/bp/8.13/pr-38407 branch March 21, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport needs_team Indicates that the issue/PR needs a Team:* label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants