Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid defragging scripts during eval #1414

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading