Fix timeout not being set in module blockClient case (#13011)

This was introduced in #13004, missing this assignment.
It causes timeout to be a random value (may be less than now),
and then in `Unblock by timer` test, the client is unblocked
and then it call timeout_callback, since the callback is NULL,
the server will crash.

The crash stack is:
```
beforesleep
handleBlockedClientsTimeout
checkBlockedClientTimeout
unblockClientOnTimeout
replyToBlockedClientTimedOut
moduleBlockedClientTimedOut
-- the timeout_callback is NULL, invalidFunctionWasCalled
bc->timeout_callback(&ctx,(void**)c->argv,c->argc);
```

Signed-off-by: Ping Xie <pingxie@google.com>
This commit is contained in:
Binbin 2024-01-30 20:32:17 +08:00 committed by Ping Xie
parent 0b7f032673
commit 900ae7aed6

View File

@ -7733,6 +7733,7 @@ ValkeyModuleBlockedClient *moduleBlockClient(ValkeyModuleCtx *ctx, ValkeyModuleC
if (keys) {
blockForKeys(c,BLOCKED_MODULE,keys,numkeys,timeout,flags&VALKEYMODULE_BLOCK_UNBLOCK_DELETED);
} else {
c->bstate.timeout = timeout;
blockClient(c,BLOCKED_MODULE);
}
}