Skip to content

lua脚本报错 #945

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

Open
hgaong opened this issue Mar 29, 2025 · 1 comment
Open

lua脚本报错 #945

hgaong opened this issue Mar 29, 2025 · 1 comment
Labels
type: question Further information is requested

Comments

@hgaong
Copy link

hgaong commented Mar 29, 2025

问题描述(Issue Description)

报错日志:

2025-03-29 12:25:31 ERR load function script failed: <string>:1: registry overflow
stack traceback:
        [G]: in function 'concat'
        <string>:1: in main chunk
        [G]: ?
                        RedisShake/internal/filter/function.go:105 -> (*Runtime).RunFunction()
                        RedisShake/cmd/redis-shake/main.go:230 -> main.func1()
                        runtime/asm_amd64.s:1650 -> goexit()


:1 意思是第一行报错? lua脚本片段如下:

function = """
shake.log("📢 ARGV : " .. table.concat(ARGV, " "))


求助~~

环境信息(Environment)

  • RedisShake 版本(RedisShake Version):
  • Redis 源端版本(Redis Source Version):
  • Redis 目的端版本(Redis Destination Version):
  • Redis 部署方式(standalone/cluster/sentinel):
  • 是否在云服务商实例上部署(Deployed on Cloud Provider):

日志信息(Logs)

如果有错误日志或其他相关日志,请在这里提供。

If there are any error logs or other relevant logs, please provide them here.

其他信息(Additional Information)

请提供任何其他相关的信息,如配置文件、错误信息或截图等。

Please provide any additional information, such as configuration files, error messages, or screenshots.

@hgaong hgaong added the type: question Further information is requested label Mar 29, 2025
@suxb201
Copy link
Member

suxb201 commented Apr 2, 2025

可能 ARGV 太大了,GPT 给了两个方案:


方案一:限制 ARGV 输出长度

shake.log("📢 ARGV (first 5): " .. table.concat({unpack(ARGV, 1, 5)}, " "))

避免拼接过长字符串导致 registry overflow。

方案二:增加异常保护

local ok, msg = pcall(function()
    shake.log("📢 ARGV : " .. table.concat(ARGV, ", "))
end)
if not ok then
    shake.log("⚠️ Error: " .. msg)
end

防止脚本崩溃时影响主程序执行。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants