Compare commits

..

1 commit

Author SHA1 Message Date
e08403faba [#301] rpc: Make client stream initialization get cancelled by dial timeout
All checks were successful
DCO / DCO (pull_request) Successful in 1m21s
Tests and linters / Tests (pull_request) Successful in 1m40s
Tests and linters / Lint (pull_request) Successful in 1m56s
* `c.conn` may be already invalidated but the rpc client can't detect this.
  `NewStream` may hang trying to open a stream with invalidated connection.
  Using timer with `dialTimeout` for `NewStream` fixes this problem.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
2024-12-06 11:32:37 +03:00

View file

@ -67,7 +67,7 @@ func (c *Client) Init(info common.CallMethodInfo, opts ...CallOption) (MessageRe
stream grpc.ClientStream
err error
}
newStreamCh := make(chan newStreamRes, 1)
newStreamCh := make(chan newStreamRes)
go func() {
stream, err := c.conn.NewStream(ctx, &grpc.StreamDesc{