openresty / lua-resty-mysql

Nonblocking Lua MySQL driver library for ngx_lua or OpenResty
708 stars 236 forks source link

The connect function is thrown incorrectly #139

Open give-it-a-try-1 opened 2 years ago

give-it-a-try-1 commented 2 years ago

When my mysql uses the connect function, it keeps throwing errors, which has cost us two weeks!! I hope someone can help me

Error: lua entry thread aborted: runtime error: attempt to yield across C-call boundary

There is no problem with mysqlConfig

local mysqlConfig = {
    host = "127.0.0.1",
    port = 3306,
    database = "win_mutil_web",
    user = "root",
    -- password = "ql532624.",
    password = "123456",
}
local db, err = mysql:new()
if not db then
    ngx.log(ngx.ERR, "failed to instantiate mysql: ", err)
    return nil
end
-- 1 sec
db:set_timeout(1000)
local ok, err, errcode, sqlstate = db:connect(mysqlConfig)

If I execute connect, I'm going to throw an error