and with your suggestions, i fix my lua code by writing new lua module , but it still report table overflow, i don't understand why, please help me ,thank a lot.
below is my lua code:
openresty lua:
nginx.conf:
...
location ~ ^/(cdnlog|livertmp) {
default_type 'text/html';
access_by_lua_file conf/lua/cdnlog.lua;
proxy_pass http://$http_host$request_uri;
...
cdnlog.lua:
...
attr= require("attr_api")
function check_request_k(key)
attr.attr_api(12345, 1)
end
check_request_k(ngx.req.get_uri_args()['k'])
...
attr_api.lua
local ffi = require "ffi"
local _M = { _VERSION = "0.1" }
ffi.cdef[[
int Attr_API(int attr, int iValue);
]]
local myffi = ffi.load("/usr/servers/nginx/conf/lua/libAttr_API.so")
function _M.attr_api(id, value)
if not myffi or not myffi.Attr_API then
ngx.log(ngx.ERR, "Load attr_api failed: ", err)
return
end
local ok, err = pcall(myffi.Attr_API, id, value)
if not ok then
ngx.log(ngx.ERR, "Attr_API call failed: ", err)
end
end
return _M
this lib (/usr/servers/nginx/conf/lua/libAttr_API.so) is not problem, the Attr_API function work correctly.
but after running one day, it report:
2025/04/26 06:43:53 [error] 34231#0: *439920047 lua entry thread aborted: runtime error: table overflow
stack traceback:
coroutine 0:
[C]: in function 'cdef'