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

Rework RPC server start process #3324

Open
AnnaShaleva opened this issue Feb 21, 2024 · 0 comments
Open

Rework RPC server start process #3324

AnnaShaleva opened this issue Feb 21, 2024 · 0 comments
Labels
enhancement Improving existing functionality I4 No visible changes rpc RPC server and client S2 Regular significance U3 Regular

Comments

@AnnaShaleva
Copy link
Member

Is your feature request related to a problem? Please describe.

After #3307 the only node service that requires from caller to send call to Start to a separate goroutine is RPC server. It's so special because it may return errors to the provided error channel, and the caller must start error channel by the moment of RPC server start:

neo-go/cli/server/server.go

Lines 503 to 506 in 327e766

// Run RPC server in a separate routine. This is necessary to avoid a potential
// deadlock: Start() can write errors to errChan which is not yet read in the
// current execution context (see for-loop below).
go rpcServer.Start()

One day it may cause a bug, because we always need to remember about this RPC server behaviour.

Describe the solution you'd like

Refactor RPC server start so that the caller is able to call Start in the same goroutine. Send code that may return errors to a separate goroutine inside Start.

Describe alternatives you've considered

Allow to return error from Start, but it'd be inconvenient since we have common Service interface and none of our services return error from start.

@AnnaShaleva AnnaShaleva added feature Completely new functionality rpc RPC server and client U3 Regular S2 Regular significance I4 No visible changes enhancement Improving existing functionality and removed feature Completely new functionality labels Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving existing functionality I4 No visible changes rpc RPC server and client S2 Regular significance U3 Regular
Projects
None yet
Development

No branches or pull requests

1 participant