wolf icon indicating copy to clipboard operation
wolf copied to clipboard

question: the wolf server log doesn't have a time

Open gaoxingliang opened this issue 7 months ago • 1 comments

I found error logs in apisix when using with wolf (with docker image docker pull igeeky/wolf-server) this happened at some times.

2025/05/22 06:41:01 [error] 70#70: *196447520 [lua] wolf-rbac.lua:206: check_url_permission(): fail request: http://wolf-server.wolf:80/wolf/rbac/access_check?resName=xxxx&action=POST&appID=data, err:closed, client: 10.233.107.0, server: _, request: "POST /v1/enterprises/customized/modules/whites HTTP/1.1", host: "xxxt.cn:88"
2025/05/22 06:41:01 [info] 70#70: *196447520 [lua] wolf-rbac.lua:279: phase_func():  check_url_permission({"status":500,"err":"request to wolf-server failed, err:closed"}) res: {"status":500,"err":"request to wolf-server failed, err:closed"}, client: xxxx, server: _, request: "POST /xxx HTTP/1.1", host: "xxxx.cn:88"
2025/05/22 06:41:01 [error] 70#70: *196447520 [lua] wolf-rbac.lua:301: phase_func():  check_url_permission({"status":500,"err":"request to wolf-server failed, err:closed"}) failed, res: {"status":500,"err":"request to wolf-server failed, err:closed"}, client: xxx, server: _, request: "POST /xxxx HTTP/1.1", host: "xxxx.cn:88"
2

when I checked the wolf server logs, it didn't has a time. and some errors like this:

 [ioredis] Unhandled error event: Error: getaddrinfo EAI_AGAIN wolf-cache

     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:26)

 create root user failed! err: ConnectionError [SequelizeConnectionError]: getaddrinfo EAI_AGAIN wolf-database

     at Client._connectionCallback (/opt/wolf/server/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:142:24)

     at Client._handleErrorWhileConnecting (/opt/wolf/server/node_modules/pg/lib/client.js:305:19)

     at Client._handleErrorEvent (/opt/wolf/server/node_modules/pg/lib/client.js:315:19)

     at Connection.emit (events.js:400:28)

     at Socket.reportStreamError (/opt/wolf/server/node_modules/pg/lib/connection.js:52:12)

     at Socket.emit (events.js:400:28)

     at emitErrorNT (internal/streams/destroy.js:106:8)

     at emitErrorCloseNT (internal/streams/destroy.js:74:3)

     at processTicksAndRejections (internal/process/task_queues.js:82:21) {

   parent: [Error],

   original: [Error]

 }

 [ioredis] Unhandled error event: Error: getaddrinfo EAI_AGAIN wolf-cache

     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:26)

 [ioredis] Unhandled error event: Error: getaddrinfo EAI_AGAIN wolf-cache

     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:26)

 [ioredis] Unhandled error event: Error: getaddrinfo EAI_AGAIN wolf-cache

     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:26)

because the log doesn't contain a time, I don't know whether the log is okay or not. Is there any other log I can check?

I test the redis manually ,its WORKING.

gaoxingliang avatar May 22 '25 08:05 gaoxingliang

I found the log at the docker container log folder. I checked the log and found the wolf didn't say anything at that time. and then I checked the wolf plugin, I found the wolf-rbac plugin, it has a retry while it DOESN'T retry when error eg network error found.

local function check_url_permission(server, appid, action, resName, client_ip, wolf_token)
    local retry_max = 3
    local errmsg
    local userInfo
    local res
    local err
    local access_check_url = server .. "/wolf/rbac/access_check"
    local headers = new_headers()
    headers["x-rbac-token"] = wolf_token
    headers["Content-Type"] = "application/json; charset=utf-8"
    local args = { appID = appid, resName = resName, action = action, clientIP = client_ip}
    local url = access_check_url .. "?" .. ngx.encode_args(args)
    local timeout = 1000 * 10

    for i = 1, retry_max do
        -- TODO: read apisix info.
        res, err = http_get(url, headers, timeout)
        if err then
            break
        else
            core.log.info("check permission request:", url, ", status:", res.status,
                            ",body:", core.json.delay_encode(res.body))
            if res.status < 500 then
                break
            else
                core.log.info("request [curl -v ", url, "] failed! status:", res.status)
                if i < retry_max then
                    sleep(0.1)
                end
            end
        end
    end

and BTW is there any plan to update the docker image to use latest code?

gaoxingliang avatar May 22 '25 08:05 gaoxingliang