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

jsonrpc: Stop background (more) rescans gracefully #2434

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jholdstock
Copy link
Member

@jholdstock jholdstock commented Oct 12, 2024

Use the server waitgroup to ensure background rescans can return on their own terms rather than being forcefully terminated early.

Using the server context instead of context.Background means that the long-lived rescan funcs are able to exit properly when the server is shutdown and its context is closed.

Based on #2435

@jholdstock jholdstock changed the title jsonrpc: Stop background rescans gracefully. jsonrpc: Stop background (more) rescans gracefully Oct 14, 2024
This ensures that the context of in-flight RPC requests is cancelled
when the dcrwallet process context is cancelled.
Use the server waitgroup to ensure background rescans can return on
their own terms rather than being forcefully terminated early.

This is still not an ideal situation because in the case where the
server/wallet is being shut down, RescanFromHeight will return with an
"rpc connection closed" error (or similar) rather than returning because
its provided context was cancelled. However, that is a notable
improvement over the existing situation which could result in an
unhandled panic.
Using the server context instead of context.Background means that the
long-lived rescan funcs are able to exit properly when the server is
shutdown and its context is closed.
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

Successfully merging this pull request may close these issues.

1 participant