Open AvyChanna opened 8 months ago
Observed the same exact behaviour, here's what I could find;
Seems like the closure here (p == pipelineProcessCmds | txPipelineProcessCmds
) is never called if the client is closed; AFAIU it is expected for processer p
to set command errors but it never gets called with a closed client.
https://github.com/redis/go-redis/blob/2d8fa02ac2b0cda80410674a4abad00ea35217e8/redis.go#L515-L519
In ClusterClient, this seems to be the path that the errors get set if the client is closed; https://github.com/redis/go-redis/blob/2d8fa02ac2b0cda80410674a4abad00ea35217e8/osscluster.go#L1221-L1224
When using a pipeline, previous versions (v8..) used to set error on all commands in a pipeline when it failed. go-redis v9 does not call
setCmdsErr
in some cases.Expected Behavior
All commands in the pipeline should have err set properly and
cmd.Err()
should return the error instead of nil for all cmdsCurrent Behavior
Commands in a failed pipeline return
"", nil
on callingResult()
Steps to Reproduce
Context (Environment)
I was trying to use
cmds.Result()
directly (ignoring return val ofpipe.Exec()
) and checking for errors in the result itself.(I don't know if this is the intended behavior or a regression. So sorry if it's the former)
I did a bisect on the code and I could narrow it down to https://github.com/redis/go-redis/commit/dd9a200427d7c57e480d61833a7204b13b55acbd .
Also, this happens on some types of clients only
Thanks