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

Fix panic when MaxRetryInterval is specified, but RetryInterval is not #35820

Merged
merged 2 commits into from
Jun 20, 2023
Merged

Fix panic when MaxRetryInterval is specified, but RetryInterval is not #35820

merged 2 commits into from
Jun 20, 2023

Conversation

tibordp
Copy link
Contributor

@tibordp tibordp commented Jun 19, 2023

What does this PR do?

In disk queue configuration, it seems like the MaxRetryInterval is read from the wrong field, which leads to a panic when RetryInterval is not provided.

Also, MaxRetryInterval doesn't seem configurable at all as it is.

Why is it important?

So MaxRetryInterval can be configured

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.

Logs

{"panic": "runtime error: invalid memory address or nil pointer dereference", "stack": "github.com/elastic/beats/v7/libbeat/cmd/instance.Run.func1.1\n\t/go/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:170\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:1038\nruntime.panicmem\n\t/usr/local/go/src/runtime/panic.go:221\nruntime.sigpanic\n\t/usr/local/go/src/runtime/signal_unix.go:735\ngh.neting.cc/elastic/beats/v7/libbeat/publisher/queue/diskqueue.SettingsForUserConfig\n\t/go/src/github.com/elastic/beats/libbeat/publisher/queue/diskqueue/config.go:165\ngh.neting.cc/elastic/beats/v7/libbeat/publisher/queue/diskqueue.queueFactory\n\t/go/src/github.com/elastic/beats/libbeat/publisher/queue/diskqueue/queue.go:104\ngh.neting.cc/elastic/beats/v7/libbeat/publisher/pipeline.createQueueBuilder.func1\n\t/go/src/github.com/elastic/beats/libbeat/publisher/pipeline/module.go:197\ngh.neting.cc/elastic/beats/v7/libbeat/publisher/pipeline.New\n\t/go/src/github.com/elastic/beats/libbeat/publisher/pipeline/pipeline.go:176\ngh.neting.cc/elastic/beats/v7/libbeat/publisher/pipeline.LoadWithSettings\n\t/go/src/github.com/elastic/beats/libbeat/publisher/pipeline/module.go:108\ngh.neting.cc/elastic/beats/v7/libbeat/publisher/pipeline.Load\n\t/go/src/github.com/elastic/beats/libbeat/publisher/pipeline/module.go:76\ngh.neting.cc/elastic/beats/v7/libbeat/cmd/instance.(*Beat).createBeater\n\t/go/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:383\ngh.neting.cc/elastic/beats/v7/libbeat/cmd/instance.(*Beat).launch\n\t/go/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:459\ngh.neting.cc/elastic/beats/v7/libbeat/cmd/instance.Run.func1\n\t/go/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:215\ngh.neting.cc/elastic/beats/v7/libbeat/cmd/instance.Run\n\t/go/src/github.com/elastic/beats/libbeat/cmd/instance/beat.go:216\ngh.neting.cc/elastic/beats/v7/libbeat/cmd.genRunCmd.func1\n\t/go/src/github.com/elastic/beats/libbeat/cmd/run.go:36\ngh.neting.cc/spf13/cobra.(*Command).execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846\ngh.neting.cc/spf13/cobra.(*Command).ExecuteC\n\t/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950\ngh.neting.cc/spf13/cobra.(*Command).Execute\n\t/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887\nmain.main\n\t/go/src/github.com/elastic/beats/x-pack/filebeat/main.go:22\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:255"}

@tibordp tibordp requested a review from a team as a code owner June 19, 2023 15:23
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jun 19, 2023
@cla-checker-service
Copy link

cla-checker-service bot commented Jun 19, 2023

💚 CLA has been signed

@mergify
Copy link
Contributor

mergify bot commented Jun 19, 2023

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @tibordp? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 19, 2023

💚 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

  • Start Time: 2023-06-19T20:49:14.703+0000

  • Duration: 75 min 40 sec

Test stats 🧪

Test Results
Failed 0
Passed 27380
Skipped 2013
Total 29393

💚 Flaky test report

Tests succeeded.

🤖 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!)

@pierrehilbert pierrehilbert requested review from faec and removed request for pierrehilbert June 19, 2023 15:39
@pierrehilbert pierrehilbert added the Team:Elastic-Agent Label for the Agent team label Jun 19, 2023
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent (Team:Elastic-Agent)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jun 19, 2023
@cmacknz
Copy link
Member

cmacknz commented Jun 19, 2023

/test

@tibordp
Copy link
Contributor Author

tibordp commented Jun 20, 2023

Is there any chance that this fix be backported to 7.x?

@cmacknz cmacknz added backport-7.17 Automated backport to the 7.17 branch with mergify backport-v8.8.0 Automated backport with mergify labels Jun 20, 2023
@pierrehilbert
Copy link
Collaborator

Let's wait for @faec's review here but no blocking point to have it backported in 7.17 on my side.

Copy link
Contributor

@faec faec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for finding this!

@faec
Copy link
Contributor

faec commented Jun 20, 2023

Looks good, I will start the backports, I think we're on track to make the impending release cuts for 7.x and 8.9

@faec faec merged commit 3b73003 into elastic:main Jun 20, 2023
mergify bot pushed a commit that referenced this pull request Jun 20, 2023
#35820)

* Fix panic when MaxRetryInterval is specified, but RetryInterval is not

* add changelog

(cherry picked from commit 3b73003)
mergify bot pushed a commit that referenced this pull request Jun 20, 2023
#35820)

* Fix panic when MaxRetryInterval is specified, but RetryInterval is not

* add changelog

(cherry picked from commit 3b73003)
faec pushed a commit that referenced this pull request Jun 20, 2023
#35820) (#35839)

* Fix panic when MaxRetryInterval is specified, but RetryInterval is not

* add changelog

(cherry picked from commit 3b73003)

Co-authored-by: Tibor Djurica Potpara <tibor.djurica@ojdip.net>
faec pushed a commit that referenced this pull request Jun 20, 2023
#35820) (#35838)

* Fix panic when MaxRetryInterval is specified, but RetryInterval is not

* add changelog

(cherry picked from commit 3b73003)

Co-authored-by: Tibor Djurica Potpara <tibor.djurica@ojdip.net>
@faec
Copy link
Contributor

faec commented Jun 20, 2023

Backports merged! I will follow up soon with a unit test but this fix should appear in the releases later this month

@reakaleek reakaleek mentioned this pull request Jul 19, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7.17 Automated backport to the 7.17 branch with mergify backport-v8.8.0 Automated backport with mergify Team:Elastic-Agent Label for the Agent team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants