1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00

fix(server): Fix crash when connection uses multiple lua scripts (#2073)

This commit is contained in:
Shahar Mike 2023-10-25 22:44:09 +03:00 committed by GitHub
parent 67b8908805
commit b2e989a4fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -1903,8 +1903,10 @@ void Service::Exec(CmdArgList args, ConnectionContext* cntx) {
}
}
if (exec_info.preborrowed_interpreter)
if (exec_info.preborrowed_interpreter) {
ServerState::tlocal()->ReturnInterpreter(exec_info.preborrowed_interpreter);
exec_info.preborrowed_interpreter = nullptr;
}
if (scheduled) {
VLOG(1) << "Exec unlocking " << exec_info.body.size() << " commands";

View file

@ -950,4 +950,13 @@ TEST_F(MultiEvalTest, ScriptSquashingUknownCmd) {
EXPECT_EQ(Run({"get", "A"}), "2");
}
TEST_F(MultiEvalTest, MultiAndEval) {
// We had a bug in borrowing interpreters which caused a crash in this scenario
Run({"multi"});
Run({"eval", "return redis.call('set', 'x', 'y1')", "1", "x"});
Run({"exec"});
Run({"eval", "return redis.call('set', 'x', 'y1')", "1", "x"});
}
} // namespace dfly