Skip to content

Commit

Permalink
Avoid defragging scripts during eval
Browse files Browse the repository at this point in the history
This can happen when long scripts are being run and we are attempting to defrag it
in the whileBlockedCron.

Signed-off-by: Ran Shidlansik <[email protected]>
  • Loading branch information
ranshid committed Dec 10, 2024
1 parent e8078b7 commit d0ac884
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/defrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
*/

#include "server.h"
#include "script.h"
#include <stddef.h>

#ifdef HAVE_DEFRAG
Expand Down Expand Up @@ -280,6 +281,12 @@ robj *activeDefragStringOb(robj *ob) {
static luaScript *activeDefragLuaScript(luaScript *script) {
luaScript *ret = NULL;

/* In case we are in the process of eval some script we do not want to replace the script being run
* so we just bail out without really defragging here. */
if (scriptIsRunning()) {
return script;
}

/* try to defrag script struct */
if ((ret = activeDefragAlloc(script))) {
script = ret;
Expand Down

0 comments on commit d0ac884

Please sign in to comment.