mirror of
https://github.com/fluencelabs/redis
synced 2025-06-23 14:01:34 +00:00
Modules: Fix blocked-client-related memory leak
If a blocked module client times-out (or disconnects, unblocked by CLIENT command, etc.) we need to call moduleUnblockClient in order to free memory allocated by the module sub-system and blocked-client private data Other changes: Made blockedonkeys.tcl tests a bit more aggressive in order to smoke-out potential memory leaks
This commit is contained in:
@ -4271,6 +4271,15 @@ void unblockClientFromModule(client *c) {
|
||||
moduleFreeContext(&ctx);
|
||||
}
|
||||
|
||||
/* If we made it here and client is still blocked it means that the command
|
||||
* timed-out, client was killed or disconnected and disconnect_callback was
|
||||
* not implemented (or it was, but RM_UnblockClient was not called from
|
||||
* within it, as it should).
|
||||
* We must call moduleUnblockClient in order to free privdata and
|
||||
* RedisModuleBlockedClient */
|
||||
if (!bc->unblocked)
|
||||
moduleUnblockClient(c);
|
||||
|
||||
bc->client = NULL;
|
||||
/* Reset the client for a new query since, for blocking commands implemented
|
||||
* into modules, we do not it immediately after the command returns (and
|
||||
|
Reference in New Issue
Block a user