Bug #49248 Proxy crashes when attempting to access resultset.fields on an error packet
| Submitted: | 1 Dec 2009 3:34 | Modified: | 9 Jan 2015 16:01 |
|---|---|---|---|
| Reporter: | Lachlan Mulcahy | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | MySQL Proxy: Core | Severity: | S2 (Serious) |
| Version: | 0.7.2 | OS: | Any |
| Assigned to: | Assigned Account | CPU Architecture: | Any |
[1 Dec 2009 3:34]
Lachlan Mulcahy
[1 Dec 2009 6:35]
Alexey Kishkin
verified, but it requires little bit more than just read_query_result:
- must be function read_query() as well, which must return proxy.PROXY_SEND_QUERY and use {resultset_is_neede=true} in the proxy.query:append().
I use following procedure for verification
lua file ax.lua:
walrus@walrus-note:~$ cat mp/ax.lua
function read_query( packet )
if string.byte(packet) == proxy.COM_QUERY then
local query = string.sub(packet, 2)
print("we got a normal query: " .. query)
local f_s, f_e, command = string.find(packet, "^%s*(%w+)", 2)
local option
if f_e then
f_s, f_e, option = string.find(packet, "^%s+(%w+)", f_e + 1)
end
if command == "bug" then
proxy.queries:append(1, string.char(proxy.COM_QUERY) .. "BUG" , {resultset_is_needed = true})
return proxy.PROXY_SEND_QUERY
elseif command == "who" then
proxy.queries:append(1, string.char(proxy.COM_QUERY) .. "SHOW PROCESSLIST" )
return proxy.PROXY_SEND_QUERY
end
end
end
function read_query_result ( inj )
print("Script invocation ".. inj.type)
fields = inj.resultset.fields
return
end
run mysql proxy as:
sbin/mysql-proxy --proxy-backend-addresses=127.0.0.1:3306 --proxy-lua-script=ax.lua --log-level=debug --log-file=logfile1.log
then in another xterm:
walrus@walrus-note:~$ mysql -h 127.0.0.1 -P 4040
mysql> abc;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'abc' at line 1
mysql> bug;
ERROR 2013 (HY000): Lost connection to MySQL server during query
in the mysql-proxy window appears:
we got a normal query: abc
we got a normal query: bug
Script invocation 1
**
** ERROR:(network-mysqld-packet.c:668):???: assertion failed: (chunk)
Abort (core dumped)
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.