You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The go-grpc-middleware retry middleware has a function perCallContext that calls context.WithTimeout and ignores the returned cancel function. According to the context.WithTimeout docs:
// Canceling this context releases resources associated with it, so code should
// call cancel as soon as the operations running in this Context complete:
//
// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
// defer cancel() // releases resources if slowOperation completes before timeout elapses
// return slowOperation(ctx)
// }
The go-grpc-middleware retry middleware has a function
perCallContext
that callscontext.WithTimeout
and ignores the returnedcancel
function. According to thecontext.WithTimeout
docs:// Canceling this context releases resources associated with it, so code should
// call cancel as soon as the operations running in this Context complete:
//
// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
// defer cancel() // releases resources if slowOperation completes before timeout elapses
// return slowOperation(ctx)
// }
Here is the offending code in https://github.com/grpc-ecosystem/go-grpc-middleware/blob/master/retry/retry.go#L290
The text was updated successfully, but these errors were encountered: