Bug #45833 Windows proxy does not find chassis.dll
Submitted: 29 Jun 2009 18:53 Modified: 17 Aug 2009 17:17
Reporter: Diego Medina
Status: Closed
Category:Proxy: Core Severity:S1 (Critical)
Version:0.7.2 OS:Microsoft Windows (XP)
Assigned to: Jan Kneschke Target Version:

[29 Jun 2009 18:53] Diego Medina
Description:
You start the proxy and use a lua file that has this line

require("proxy.chassis")

Once you send a query through the proxy, you will see errors on the terminal similar to
these:

(critical) (lua-error) [C:\Documents and
Settings\Wizard\Desktop\mysql-proxy-0.7.2-win32\share\doc\mysql-proxy\tutorial-basic.lua]
[string "C:\Documents and Settings\Wizard\Desktop\my..."]:38: module 'proxy.chassis' not
found:
	no field package.preload['proxy.chassis']
	no file 'C:\Documents and
Settings\Wizard\Desktop\mysql-proxy-0.7.2-win32\lib\mysql-proxy\lua\proxy\chassis.lua'
	no file 'C:\Documents and
Settings\Wizard\Desktop\mysql-proxy-0.7.2-win32\lib\mysql-proxy\lua\proxy\chassis.dll'
	no file 'C:\Documents and
Settings\Wizard\Desktop\mysql-proxy-0.7.2-win32\lib\mysql-proxy\lua\proxy.dll'

How to repeat:
1- Start the proxy on windows
2- Use this lua script

require("proxy.chassis")
function read_query( packet )
	if string.byte(packet) == proxy.COM_QUERY then
		print("we got a normal query: " .. string.sub(packet, 2))
	end
end

3- Send some queries through the proxy port
4- Look at the terminal where you started the proxy.
[29 Jun 2009 20:34] Enterprise Tools JIRA Robot
Diego Medina writes: 
I tried setting

$ set LUA_CPATH="!/?.dll"

and then start the proxy from this same terminal.
The problem is that it looks for chassis.dll in 

./bin/proxy/chassis.dll

but it is on

./bin/chassis.dll

So I changed the lua script to have

require("chassis")

and I did

$ set LUA_CPATH=!/?.dll

and then it all worked.

Note that we have some example files that have require("proxy.commands") among others,
so, it would be better if we create the proxy folder to hold the dll files

See ./share/doc/mysql-proxy/active-queries.lua

it has

 commands = require("proxy.commands")
[30 Jun 2009 16:11] Jan Kneschke
The plugins are now prefixed with "plugin-" in the bin/ folder, the lua c-based modules
are prefixed with lua- and are also in the bin/ folder to make windows find them.

The internals know about this and hide it automaticly from the user. The pluginname in
the config file is still "proxy" and the require() in lua still looks for "chassis" or
"lfs".
[30 Jun 2009 17:22] Enterprise Tools JIRA Robot
Diego Medina writes: 
Verified fixed on 0.7.2
[17 Aug 2009 17:17] MC Brown
A note has been added to the 0.7.2 changelog: 

When using MySQL Proxy on Windows, the required modules may not be found properly during
initialization. The core code has now been updated to find the components correctly, and
the Lua-based C modules are prefixed with lua- and Lua plugins with plugin-.