⚠️ Potential issue | 🟠 Major
Close leaks the gRPC connection because we never retain or close it
DialPricePoster creates a client connection but drops the handle, and Close() is a no-op. The pricefeeder’s shutdown hooks expect this to release network resources. Store the *grpc.ClientConn and close it (logging on error) during Close().
type deps struct {
oracleClient Oracle
authClient Auth
txClient TxService
keyBase keyring.Keyring
txConfig client.TxConfig
ir codectypes.InterfaceRegistry
chainID string
+ conn *grpc.ClientConn
}
@@
deps := deps{
+ conn: conn,
oracleClient: oracletypes.NewQueryClient(conn),
authClient: authtypes.NewQueryClient(conn),
txClient: txservice.NewServiceClient(conn),
@@
func (c *ClientPricePoster) Close() {
+ if c.deps.conn != nil {
+ if err := c.deps.conn.Close(); err != nil {
+ c.logger.Err(err).Msg("failed to close price poster connection")
+ }
+ }
}
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In feeder/priceposter.go around lines 101 to 145, the Close method currently
does nothing while DialPricePoster creates a gRPC client connection and drops
the handle, leaking the network resource; modify the ClientPricePoster struct to
hold a *grpc.ClientConn field, update DialPricePoster to assign the created
connection to that field instead of discarding it, and implement Close() to
check for a non-nil conn, call conn.Close(), and log any returned error via
c.logger (and return/ignore the error per existing Close signature), ensuring
nil-safe behavior so the connection is released on shutdown.
Originally posted by @coderabbitai[bot] in #81 (comment)
Close leaks the gRPC connection because we never retain or close it
DialPricePostercreates a client connection but drops the handle, andClose()is a no-op. The pricefeeder’s shutdown hooks expect this to release network resources. Store the*grpc.ClientConnand close it (logging on error) duringClose().type deps struct { oracleClient Oracle authClient Auth txClient TxService keyBase keyring.Keyring txConfig client.TxConfig ir codectypes.InterfaceRegistry chainID string + conn *grpc.ClientConn } @@ deps := deps{ + conn: conn, oracleClient: oracletypes.NewQueryClient(conn), authClient: authtypes.NewQueryClient(conn), txClient: txservice.NewServiceClient(conn), @@ func (c *ClientPricePoster) Close() { + if c.deps.conn != nil { + if err := c.deps.conn.Close(); err != nil { + c.logger.Err(err).Msg("failed to close price poster connection") + } + } }🤖 Prompt for AI Agents
Originally posted by @coderabbitai[bot] in #81 (comment)