Git Product home page Git Product logo

Comments (6)

agentzh avatar agentzh commented on July 25, 2024

@heyuanlong Will you provide a minimal and self-contained code example that can reproduce this?

from lua-resty-mysql.

heyuanlong avatar heyuanlong commented on July 25, 2024

我的代码
if mysqlConn then local res, err, errno, sqlstate = mysqlConn:read_result() while err == "again" do res, err, errno, sqlstate = mysqlConn:read_result() end local ok, err = mysqlConn:set_keepalive(10000, 100) if not ok then mysqlConn:close() ok = false db_type = db_type + mysql_type err = "MySQL.Error ( "..(err or "null").." ) " end end
报的错误:
2016/04/29 16:57:30 [error] 17843#0: *46412 lua entry thread aborted: runtime error: /data/sns.kobox.tv/lib/sns_common/resty/mysql.lua:794: attempt to concatenate field 'state' (a nil value)
stack traceback:
coroutine 0:
/data/sns.kobox.tv/lib/sns_common/resty/mysql.lua: in function 'read_result'
/data/matchvs.com/lib/user/connection.lua:72: in function 'releaseConn'

from lua-resty-mysql.

heyuanlong avatar heyuanlong commented on July 25, 2024

if mysqlConn then
local res, err, errno, sqlstate = mysqlConn:read_result()
while err == "again" do
res, err, errno, sqlstate = mysqlConn:read_result()
end
local ok, err = mysqlConn:set_keepalive(10000, 100)
if not ok then
mysqlConn:close()
ok = false
db_type = db_type + mysql_type
err = "MySQL.Error ( "..(err or "null").." ) "
end
end

from lua-resty-mysql.

heyuanlong avatar heyuanlong commented on July 25, 2024
local function read_result(self)
              if self.state ~= STATE_COMMAND_SENT then
        return nil, "cannot read result in the current context: " .. (self.state or "nil")--增加判断吧
    end

from lua-resty-mysql.

agentzh avatar agentzh commented on July 25, 2024

@heyuanlong Please do not use Chinese here. Thank you.

Regarding the issue, yes, we should add the or "" part there. Patches welcome and pull requests welcome :)

from lua-resty-mysql.

agentzh avatar agentzh commented on July 25, 2024

Committed a fix to git master. Thanks for the report.

from lua-resty-mysql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.