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

Gracefully handle shutdown in worker pool #107

Open
calbera opened this issue Jul 5, 2024 · 0 comments
Open

Gracefully handle shutdown in worker pool #107

calbera opened this issue Jul 5, 2024 · 0 comments
Assignees

Comments

@calbera
Copy link
Contributor

calbera commented Jul 5, 2024

When shutting down an application, may see a panic like below

panic: context canceled

goroutine 1 [running]:
github.com/berachain/offchain-sdk/baseapp.(*JobManager).RunProducers(0xc00050f0b0, {0x1609860, 0xc000338ac0})
    /go/pkg/mod/github.com/berachain/offchain-sdk@v0.0.0-20240530213602-4f6189f6c32f/baseapp/job_manager.go:147 +0xb98
github.com/berachain/offchain-sdk/baseapp.(*BaseApp).Start(0xc00050f1a0, {0x1609860, 0xc000338ac0})
    /go/pkg/mod/github.com/berachain/offchain-sdk@v0.0.0-20240530213602-4f6189f6c32f/baseapp/baseapp.go:65 +0x18c
github.com/berachain/offchain-sdk/cmd.StartCmdWithOptions[...].func1({0x12eac5e, 0x4?, 0x12eab66?})
    /go/pkg/mod/github.com/berachain/offchain-sdk@v0.0.0-20240530213602-4f6189f6c32f/cmd/start.go:104 +0x504
github.com/spf13/cobra.(*Command).execute(0xc000328308, {0xc0003e4980, 0x2, 0x2})
    /go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc000328008)
    /go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0x15f8190?)
    /go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039 +0x13
main.main()
    /runner/mod/distributor/cmd/main.go:14 +0x4a

For any routines that are still ongoing, gracefully wait for completion to prevent unwanted panics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants