Replies: 2 comments 2 replies
-
The error happens when APISIX passes a table to There’s no Alpine-specific logic in APISIX for this, but subtle differences in musl libc or how OpenResty/LuaJIT behave on Alpine can cause parsing bugs. The code expects upstream nodes to be parsed into objects with To troubleshoot:
If the error only happens on Alpine, it’s probably a musl/OpenResty/LuaJIT edge case. You might need to experiment with different OpenResty or LuaJIT builds, or patch the parsing logic to handle any unexpected types. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
I found some diferences from the balancer.lua on alpine and debian: function _M.set_current_peer(addr, port, host)
local r = get_request()
if not r then
error("no request found")
end
if not port then
port = 0
elseif type(port) ~= "number" then
port = tonumber(port)
end
if host ~= nil and type(host) ~= "string" then
error("bad argument #3 to 'set_current_peer' "
.. "(string expected, got " .. type(host) .. ")")
end
local rc = ngx_lua_ffi_balancer_set_current_peer(r, addr, #addr,
port,
host,
host and #host or 0,
errmsg)
if rc == FFI_OK then
return true
end
return nil, ffi_str(errmsg[0])
end balancer.debian function _M.set_current_peer(addr, port, opts)
local r = get_request()
if not r then
error("no request found")
end
local pool_crc32
local pool_size
if opts then
if type(opts) ~= "table" then
error("bad argument #3 to 'set_current_peer' " ..
"(table expected, got " .. type(opts) .. ")", 2)
end
local pool = opts.pool
pool_size = opts.pool_size
if pool then
if type(pool) ~= "string" then
error("bad option 'pool' to 'set_current_peer' " ..
"(string expected, got " .. type(pool) .. ")", 2)
end
pool_crc32 = ngx_crc32_long(pool)
end
if pool_size then
if type(pool_size) ~= "number" then
error("bad option 'pool_size' to 'set_current_peer' " ..
"(number expected, got " .. type(pool_size) .. ")", 2)
elseif pool_size < 1 then
error("bad option 'pool_size' to 'set_current_peer' " ..
"(expected > 0)", 2)
end
end
end
if not port then
port = 0
elseif type(port) ~= "number" then
port = tonumber(port)
end
if not pool_crc32 then
pool_crc32 = 0
end
if not pool_size then
pool_size = DEFAULT_KEEPALIVE_POOL_SIZE
end
local rc = ngx_lua_ffi_balancer_set_current_peer(r, addr, #addr, port,
pool_crc32, pool_size,
errmsg)
if rc == FFI_OK then
return true
end
return nil, ffi_str(errmsg[0])
end I fix doing this: function _M.set_current_peer(addr, port, opts)
local r = get_request()
if not r then
error("no request found")
end
if not port then
port = 0
elseif type(port) ~= "number" then
port = tonumber(port)
end
local host
if opts then
if type(opts) ~= "table" then
error("bad argument #3 to 'set_current_peer' " ..
"(table expected, got " .. type(opts) .. ")", 2)
end
host = opts.pool
end
local rc = ngx_lua_ffi_balancer_set_current_peer(r, addr, #addr,
port,
host,
host and #host or 0,
errmsg)
if rc == FFI_OK then
return true
end
return nil, ffi_str(errmsg[0])
end Idk if apisix is going to work well |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi I'm build an image of apisix with alpine linux and I have this error:
Steps to reproduce:
config.yaml
docker-entrypoint
Build the apisix with the alpine image
docker-compose.yaml
add the route:
I check the issue: #12545 but doesn't help
I'm no able to use the oficial image because I can't solve the vulnerabilities in it
Any help?
Beta Was this translation helpful? Give feedback.
All reactions