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:
parent
67b8908805
commit
b2e989a4fb
2 changed files with 12 additions and 1 deletions
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue