-
Notifications
You must be signed in to change notification settings - Fork 29
Revert "Clean up dropped resources in relayer construction (#1927)" #2026
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -61,7 +61,7 @@ func (p *PluginRelayerClient) NewRelayer(ctx context.Context, config string, key | |||||
| pb.RegisterKeystoreServer(s, ks.NewServer(keystore)) | ||||||
| }) | ||||||
| if err != nil { | ||||||
| return 0, deps, fmt.Errorf("Failed to create relayer client: failed to serve keystore: %w", err) | ||||||
| return 0, nil, fmt.Errorf("Failed to create relayer client: failed to serve keystore: %w", err) | ||||||
| } | ||||||
| deps.Add(ksRes) | ||||||
|
|
||||||
|
|
@@ -70,15 +70,15 @@ func (p *PluginRelayerClient) NewRelayer(ctx context.Context, config string, key | |||||
| pb.RegisterKeystoreServer(s, ks.NewServer(csaKeystore)) | ||||||
| }) | ||||||
| if err != nil { | ||||||
| return 0, deps, fmt.Errorf("Failed to create relayer client: failed to serve CSA keystore: %w", err) | ||||||
| return 0, nil, fmt.Errorf("Failed to create relayer client: failed to serve CSA keystore: %w", err) | ||||||
| } | ||||||
| deps.Add(ksCSARes) | ||||||
|
|
||||||
| capabilityRegistryID, capabilityRegistryResource, err := p.ServeNew("CapabilitiesRegistry", func(s *grpc.Server) { | ||||||
| pb.RegisterCapabilitiesRegistryServer(s, capability.NewCapabilitiesRegistryServer(p.BrokerExt, capabilityRegistry)) | ||||||
| }) | ||||||
| if err != nil { | ||||||
| return 0, deps, fmt.Errorf("failed to serve new capability registry: %w", err) | ||||||
| return 0, nil, fmt.Errorf("failed to serve new capability registry: %w", err) | ||||||
| } | ||||||
| deps.Add(capabilityRegistryResource) | ||||||
|
|
||||||
|
|
@@ -89,9 +89,9 @@ func (p *PluginRelayerClient) NewRelayer(ctx context.Context, config string, key | |||||
| CapabilityRegistryID: capabilityRegistryID, | ||||||
| }) | ||||||
| if err != nil { | ||||||
| return 0, deps, fmt.Errorf("Failed to create relayer client: failed request: %w", err) | ||||||
| return 0, nil, fmt.Errorf("Failed to create relayer client: failed request: %w", err) | ||||||
| } | ||||||
| return reply.RelayerID, deps, nil | ||||||
| return reply.RelayerID, nil, nil | ||||||
| }) | ||||||
|
Comment on lines
91
to
95
|
||||||
| return newRelayerClient(p.BrokerExt, cc), nil | ||||||
| } | ||||||
|
|
@@ -127,7 +127,7 @@ func (p *pluginRelayerServer) NewRelayer(ctx context.Context, request *pb.NewRel | |||||
| p.CloseAll(ksRes) | ||||||
| return nil, net.ErrConnDial{Name: "CSAKeystore", ID: request.KeystoreCSAID, Err: err} | ||||||
| } | ||||||
| ksCSARes := net.Resource{Closer: ksCSAConn, Name: "CSAKeystore"} | ||||||
| ksCSARes := net.Resource{Closer: ksConn, Name: "CSAKeystore"} | ||||||
|
||||||
| ksCSARes := net.Resource{Closer: ksConn, Name: "CSAKeystore"} | |
| ksCSARes := net.Resource{Closer: ksCSAConn, Name: "CSAKeystore"} |
Copilot
AI
Apr 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If ExtraDataCodecBundle is successfully served and then NewCCIPProvider returns an error, this currently returns nil deps, so edcRes won’t be cleaned up by the clientConn lifecycle and the server can be left running. Return the accumulated deps on error (or close edcRes before returning).
| return 0, nil, err | |
| return 0, deps, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On this error path, the keystore server (
ksRes) may already have been started and added todeps, but the function returnsnildeps. BecauseclientConn.refresh()only closes the deps that are returned, this can leak the already-started server(s) when a laterServeNew/RPC step fails. Return the accumulateddepson error, or explicitly close them before returning.