Skip to content

Wait command fails with CROSSSLOT error when used in a TXPipeline with one key #3607

@marcoferrer

Description

@marcoferrer

Issue tracker is used for reporting bugs and discussing new features. Please use
stackoverflow for supporting issues.

During a library upgrade, we noticed that certain code paths using a TxPipeline started failing with CROSSSLOT errors. While this is expected for some of our usage, it was unexpected for txs that only set one key followed by a wait.

We confirmed this error manifests as part of the changes introduced in v9.11.0. But it seems like the Wait command was not included in the keyless command fix introduced in #3411

Expected Behavior

The txpipeline should complete successfully when all commands map to the same slot and a wait is used.

Current Behavior

The call fails with a CROSSSLOTS error

Possible Solution

Add Wait to the keylessCommands set

var keylessCommands = map[string]struct{}{

Steps to Reproduce

	_, err := client.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
		p := pipe.(*redis.Pipeline)
		p.Set(ctx, "my-key", "my-value", 100*time.Second)
		p.Wait(ctx, 2, 2*time.Second)
		return nil
	})
        println(err)

Context (Environment)

go-redis/v9.17.0
Go 1.25.1

Detailed Description

Possible Implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions