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: NPE on empty pool configuration #297

Merged
merged 2 commits into from
Nov 22, 2022
Merged

Conversation

rustatian
Copy link
Collaborator

@rustatian rustatian commented Nov 22, 2022

Reason for This PR

  • NPE if the user doesn't use an activities in the configuration
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x18 pc=0x1b84eea]

goroutine 1 [running]:
github.com/roadrunner-server/sdk/v2/pool.(*Config).InitDefaults(...)
        github.com/roadrunner-server/sdk/v2@v2.19.0/pool/config.go:39
github.com/roadrunner-server/sdk/v2/pool.NewStaticPool({0x2caf940?, 0xc00004a0e8?}, 0xc000934c60?, {0x2ca8050?, 0xc00062cb68?}, {0x262a2a0?, 0x0?}, 0x110?)
        github.com/roadrunner-server/sdk/v2@v2.19.0/pool/static_pool.go:58 +0x6a
github.com/roadrunner-server/server/v2.(*Plugin).NewWorkerPool(0xc000662f00, {0x2caf940, 0xc00004a0e8}, {0x262a2a0, 0x0}, 0x8?, 0x30fcfdd?)
        github.com/roadrunner-server/server/v2@v2.16.4/plugin.go:246 +0x125
github.com/temporalio/roadrunner-temporal.(*Plugin).initPool(0xc000856140)
        github.com/temporalio/roadrunner-temporal@v1.7.0/plugin.go:489 +0x126
github.com/temporalio/roadrunner-temporal.(*Plugin).Serve(0xc000856140)
        github.com/temporalio/roadrunner-temporal@v1.7.0/plugin.go:275 +0x14b0
reflect.Value.call({0xc000b86540?, 0xc0002096d0?, 0x1f6d09e0a28?}, {0x2966d97, 0x4}, {0xc0007df148, 0x1, 0x2ccfef0?})
        reflect/value.go:584 +0x8c5
reflect.Value.Call({0xc000b86540?, 0xc0002096d0?, 0x0?}, {0xc0007df148?, 0x2ccfef0?, 0xc000b86540?})
        reflect/value.go:368 +0xbc
github.com/roadrunner-server/endure/pkg/container.(*Endure).callServeFn(0xc0006247e0, 0xc000266f20, {0xc0007df148, 0x1, 0x1})
        github.com/roadrunner-server/endure@v1.4.5/pkg/container/serve.go:18 +0x24b
github.com/roadrunner-server/endure/pkg/container.(*Endure).serveInternal(0xc0006247e0, 0xc00022e420)
        github.com/roadrunner-server/endure@v1.4.5/pkg/container/serve.go:50 +0x1c7
github.com/roadrunner-server/endure/pkg/container.(*Endure).Start(0xc0006247e0)
        github.com/roadrunner-server/endure@v1.4.5/pkg/container/endure.go:445 +0x85
reflect.Value.call({0xc000106840?, 0xc00062c3b8?, 0x1f6d09e0a28?}, {0x2966d97, 0x4}, {0xc00022e9a8, 0x1, 0xd5f3d6?})
        reflect/value.go:584 +0x8c5
reflect.Value.Call({0xc000106840?, 0xc00062c3b8?, 0xc000000001?}, {0xc00022e9a8?, 0xc000008e10?, 0x0?})
        reflect/value.go:368 +0xbc
github.com/roadrunner-server/endure/pkg/fsm.(*FSMImpl).Transition(0xc000008c48, 0x1, {0xc00023d520, 0x1, 0x1?})
github.com/roadrunner-server/endure/pkg/container.(*Endure).Serve(0xc0006247e0)
        github.com/roadrunner-server/endure@v1.4.5/pkg/container/endure.go:327 +0xd9
github.com/roadrunner-server/roadrunner/v2/internal/cli/serve.NewCommand.func1(0xc000827180, {0x2967367, 0x0, 0x0})
        github.com/roadrunner-server/roadrunner/v2/internal/cli/serve/command.go:66 +0x445
github.com/spf13/cobra.(*Command).execute(0xc000827180, {0x3d89978, 0x0, 0x0})
        github.com/spf13/cobra@v1.5.0/command.go:872 +0x694
github.com/spf13/cobra.(*Command).ExecuteC(0xc000826a00)
        github.com/spf13/cobra@v1.5.0/command.go:990 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/cobra@v1.5.0/command.go:918
        github.com/roadrunner-server/roadrunner/v2/cmd/rr/main.go:21 +0x45
        github.com/roadrunner-server/roadrunner/v2/cmd/rr/main.go:15 +0x19

Description of Changes

  • Properly initialize the pool of workers configuration.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the MIT license.

PR Checklist

[Author TODO: Meet these criteria.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]

  • All commits in this PR are signed (git commit -s).
  • The reason for this PR is clearly provided (issue no. or explanation).
  • The description of changes is clear and encompassing.
  • Any required documentation changes (code and docs) are included in this PR.
  • Any user-facing changes are mentioned in CHANGELOG.md.
  • All added/changed functionality is tested.

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian added B-bug Bug: bug, unhandled exception B-crash Bug: category of the bugs which leads to application crush labels Nov 22, 2022
@rustatian rustatian added this to the v2.x milestone Nov 22, 2022
@rustatian rustatian self-assigned this Nov 22, 2022
@rustatian rustatian merged commit 6986c70 into master Nov 22, 2022
@rustatian rustatian deleted the fix/NPE-on-empty-config branch November 22, 2022 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-bug Bug: bug, unhandled exception B-crash Bug: category of the bugs which leads to application crush
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants