Skip to content

Commit

Permalink
fix: increase lua stack limit to 8KB
Browse files Browse the repository at this point in the history
Before that 'lua_checkstack(lua(), 7000)' would not pass because we limited lua stack to 4KB.
7000 is the max limit used by bullmq, so we raising it to support this case.

Signed-off-by: Roman Gershman <[email protected]>
  • Loading branch information
romange committed May 25, 2024
1 parent 9d623d0 commit 0467e9b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 49 deletions.
48 changes: 0 additions & 48 deletions patches/lua-v5.4.4.patch

This file was deleted.

2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ endif()
add_third_party(
lua
GIT_REPOSITORY https://github.com/dragonflydb/lua
GIT_TAG Dragonfly-5.4.6
GIT_TAG Dragonfly-5.4.6a
CONFIGURE_COMMAND echo
BUILD_IN_SOURCE 1
BUILD_COMMAND ${DFLY_TOOLS_MAKE} all
Expand Down
22 changes: 22 additions & 0 deletions src/core/interpreter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class InterpreterTest : public ::testing::Test {

void SetGlobalArray(const char* name, const vector<string_view>& vec);

// returns true if script run successfully.
bool Execute(string_view script);

Interpreter intptr_;
Expand Down Expand Up @@ -492,4 +493,25 @@ TEST_F(InterpreterTest, Robust) {
EXPECT_EQ("", ser_.res);
}

TEST_F(InterpreterTest, Unpack) {
auto cb = [](Interpreter::CallArgs ca) {
auto* reply = ca.translator;
reply->OnInt(1);
};
intptr_.SetRedisFunc(cb);
ASSERT_TRUE(lua_checkstack(lua(), 7000));
bool res = Execute(R"(
local N = 7000
local stringTable = {}
for i = 1, N do
stringTable[i] = "String " .. i
end
return redis.pcall('func', unpack(stringTable))
)");

ASSERT_TRUE(res) << error_;
EXPECT_EQ("i(1)", ser_.res);
}

} // namespace dfly

0 comments on commit 0467e9b

Please sign in to comment.