Repository navigation
fix(service)!: join remaining service workers before shutdown completes #1515
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
Open
lklimek
wants to merge
45
commits into
dev
Choose a base branch
from
fix/base-service-stop
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,835
−778
Open
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
8a13f0e
fix(service): drain managed workers before releasing resources
lklimek 85f9fae
refactor(p2p): join service-owned workers during shutdown
lklimek a6ca9e6
refactor(service): join owned workers before releasing resources
lklimek fad5da3
fix(mempool): cancel and join all recheck batches during shutdown
lklimek 8d16f56
fix(service): close remaining shutdown admission and rollback gaps
lklimek 82d312f
fix(rpc): drain handlers and websocket sessions before shutdown
lklimek f717b4c
fix(node): drain RPC and mempool before releasing dependencies
lklimek 63a524e
fix(rpc): unblock transport I/O before draining handlers
lklimek 053357f
Merge branch 'v1.8-dev' into fix/base-service-stop
lklimek 0c3e553
Merge v1.8-dev (#1513 lifecycle core) into fix/base-service-stop
lklimek 2cbc4c9
test(consensus): join the test event bus before the test ends
lklimek aaa3d65
Merge branch 'v1.8-dev' into fix/base-service-stop
lklimek d97ddbc
test: import libs/db after the database adapter backport
lklimek e549ab4
test(rpc): report Serve's result when cancellation does not unblock a…
lklimek 687318c
fix(node): close pprof and Prometheus servers instead of waiting on c…
lklimek 915d9bc
refactor(node): share child teardown between shutdown and failed startup
lklimek 1ff0319
docs: describe light RPC client and JSON-RPC server shutdown changes
lklimek 6c0bdf2
fix(abci): close ABCI socket connections on server shutdown
lklimek b845e6c
fix(light): bound WebSocket unsubscribe cleanup by its owner's lifetime
lklimek d87e9b2
fix(abci): release only the routed clients a start attempt started
lklimek 878993c
fix(p2p): close an abandoned channel queue outside channelMtx
lklimek b720244
fix(privval): interrupt pending signer I/O before taking the endpoint…
lklimek 2f4af16
fix(node): release node resources when startup fails
lklimek 6355218
test(node): pin failed-start rollback ordering and document its limits
lklimek 91884d1
fix(abci): cancel routed children before joining them on failed start
lklimek f68fd08
test(abci): assert the failed routed attempt started its child
lklimek 8beb2f1
fix(light): bound proxy disconnect cleanup when only the listener closes
lklimek 96129a9
fix(rpc): forget subscriptions before UnsubscribeAll sends upstream
lklimek f13a608
test(rpc): let the delivery block before releasing it
lklimek eda4da4
fix(node): release a full node's Dash Core RPC client
lklimek e6f9176
docs(node): state what the Dash Core client's close bound covers
lklimek c4470c8
fix(rpc): make WSClient.Stop idempotent
lklimek 5c812a1
fix(rpc): bound WSClient dials and worker failure reports after cancel
lklimek d942aa1
fix(light): do not join a wrapped client the caller already started
lklimek 1b42722
fix(rpc): join HTTP client event workers on stop
lklimek de50c6a
test(rpc): remove timing assumptions from WebSocket client tests
lklimek 34a3dae
Merge branch 'v1.8-dev' into fix/base-service-stop
lklimek 6fb4a4c
fix(privval): close the gRPC signer connection in SignerClient.Close
lklimek 564a3bc
Merge branch 'dev' into fix/base-service-stop
lklimek 2b0f6c1
Merge remote-tracking branch 'origin/dev' into fix/base-service-stop
lklimek eff6da2
fix(light): leave an already started HTTP client to its caller
lklimek 4679015
fix(rpc): unsubscribe only the departing subscriber's queries
lklimek 9f412b5
test(rpc): reproduce lost upstream subscription on concurrent join an…
lklimek fd00190
fix(rpc): order upstream subscribes with unsubscribes of unused queries
lklimek 86a6934
test(rpc): stress concurrent joins and leaves of a shared query
lklimek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| package abciclient_test | ||
|
|
||
| import ( | ||
| "context" | ||
| "errors" | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/stretchr/testify/require" | ||
|
|
||
| abciclient "github.com/dashpay/tenderdash/abci/client" | ||
| "github.com/dashpay/tenderdash/abci/types" | ||
| "github.com/dashpay/tenderdash/libs/log" | ||
| ) | ||
|
|
||
| var errChildStart = errors.New("child start failed") | ||
|
|
||
| type failingStartClient struct{ abciclient.Client } | ||
|
|
||
| func (failingStartClient) Start(context.Context) error { return errChildStart } | ||
| func (failingStartClient) IsRunning() bool { return false } | ||
| func (failingStartClient) Wait() {} | ||
|
|
||
| // noStopClient satisfies Client while hiding Stop, which Client does not require. | ||
| type noStopClient struct{ abciclient.Client } | ||
|
|
||
| // A failed start must stop and join the children it started, and leave alone | ||
| // a client the caller had already started. | ||
| func TestRoutedClientFailedStartReleasesOnlyItsChildren(t *testing.T) { | ||
| testCases := map[string]func(abciclient.Client) abciclient.Client{ | ||
| "child exposes Stop": func(c abciclient.Client) abciclient.Client { return c }, | ||
| "child hides Stop": func(c abciclient.Client) abciclient.Client { return noStopClient{c} }, | ||
| } | ||
| for name, wrap := range testCases { | ||
| t.Run(name, func(t *testing.T) { | ||
| logger := log.NewNopLogger() | ||
| callerCtx, cancelCaller := context.WithCancel(context.Background()) | ||
| defer cancelCaller() | ||
| callerOwned := abciclient.NewLocalClient(logger, types.NewBaseApplication()) | ||
| require.NoError(t, callerOwned.Start(callerCtx)) | ||
| attemptOwned := abciclient.NewLocalClient(logger, types.NewBaseApplication()) | ||
| routing := abciclient.Routing{ | ||
| "Info": {{Client: callerOwned, ClientID: "caller"}}, | ||
| "Query": {{Client: wrap(attemptOwned), ClientID: "attempt"}}, | ||
| } | ||
| routed, err := abciclient.NewRoutedClient(logger, failingStartClient{}, routing) | ||
| require.NoError(t, err) | ||
|
|
||
| started := make(chan error, 1) | ||
| go func() { started <- routed.Start(context.Background()) }() | ||
| select { | ||
| case err := <-started: | ||
| require.ErrorIs(t, err, errChildStart) | ||
| case <-time.After(5 * time.Second): | ||
| t.Fatal("failed start blocked joining a client") | ||
| } | ||
| require.False(t, attemptOwned.IsRunning(), "child started by the failed attempt kept running") | ||
| joined := make(chan struct{}) | ||
| go func() { attemptOwned.Wait(); close(joined) }() | ||
| select { | ||
| case <-joined: | ||
| case <-time.After(5 * time.Second): | ||
| t.Fatal("child started by the failed attempt was not joined") | ||
| } | ||
| // Only a client that started and stopped refuses another start. | ||
| require.ErrorContains(t, attemptOwned.Start(callerCtx), "already stopped", | ||
| "the failed attempt never started this child") | ||
| require.True(t, callerOwned.IsRunning(), "failed start stopped a caller-owned client") | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.