Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors with local 'len' variable #50

Closed
th0rb opened this issue Aug 25, 2016 · 7 comments
Closed

Errors with local 'len' variable #50

th0rb opened this issue Aug 25, 2016 · 7 comments

Comments

@th0rb
Copy link

th0rb commented Aug 25, 2016

*454 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/mysql.lua:300: attempt to perform arithmetic on local 'len' (a boolean value) stack traceback: coroutine 0: /usr/local/openresty/lualib/resty/mysql.lua: in function '_from_length_coded_str' /usr/local/openresty/lualib/resty/mysql.lua:423: in function '_parse_row_data_packet' /usr/local/openresty/lualib/resty/mysql.lua:870: in function 'query'

This error appeared after we migrate to MYSQL 5.7.14, in previous versions everything was ok.

currently we use:
openresty/1.11.2.1
lua-resty-mysql-0.16

@moonbingbing
Copy link

function _from_length_coded_bin() return false here :
https://github.com/openresty/lua-resty-mysql/blob/master/lib/resty/mysql.lua#L289.
I think that's the reason.
Maybe we should add condition for false in this line:
https://github.com/openresty/lua-resty-mysql/blob/master/lib/resty/mysql.lua#L296

2016-08-25 19:07 GMT+08:00 Dmitry Kuzmin notifications@github.com:

*454 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/mysql.lua:300:
attempt to perform arithmetic on local 'len' (a boolean value) stack
traceback: coroutine 0: /usr/local/openresty/lualib/resty/mysql.lua: in
function '_from_length_coded_str' /usr/local/openresty/lualib/resty/mysql.lua:423:
in function '_parse_row_data_packet' /usr/local/openresty/lualib/resty/mysql.lua:870:
in function 'query'

This error appeared after we migrate to MYSQL 5.7.14, in previous versions
everything was ok.

currently we use:
openresty/1.11.2.1
lua-resty-mysql-0.16


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#50, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAtlfPWC9RS-a5Lr1vq_1pdaTmRcY_w7ks5qjXdfgaJpZM4Js84r
.

@th0rb
Copy link
Author

th0rb commented Aug 25, 2016

Can i help you somehow to fix this ASAP?

@bungle
Copy link
Member

bungle commented Aug 25, 2016

@th0rb can you add in this line: https://github.com/openresty/lua-resty-mysql/blob/master/lib/resty/mysql.lua#L288

ngx.log(ngx.ERR, tostring(first))

And report what got logged?

@agentzh
Copy link
Member

agentzh commented Aug 25, 2016

@th0rb Please try this patch:

diff --git a/lib/resty/mysql.lua b/lib/resty/mysql.lua
index 99a253e..7860192 100644
--- a/lib/resty/mysql.lua
+++ b/lib/resty/mysql.lua
@@ -286,14 +286,14 @@ local function _from_length_coded_bin(data, pos)
         return _get_byte8(data, pos)
     end

-    return false, pos + 1
+    return nil, pos + 1
 end


 local function _from_length_coded_str(data, pos)
     local len
     len, pos = _from_length_coded_bin(data, pos)
-    if len == nil or len == null then
+    if not len or len == null then
         return null, pos
     end

@th0rb
Copy link
Author

th0rb commented Aug 26, 2016

@agentzh thanks, will try it now

@th0rb
Copy link
Author

th0rb commented Aug 30, 2016

@agentzh well, error disapeared, thank a lot for your help. Hope this fix find its way to next release

@agentzh
Copy link
Member

agentzh commented Aug 30, 2016

@th0rb Thanks for the feedback! Just committed to master. And yes, it will get included in the next release.

@agentzh agentzh closed this as completed Aug 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants