Bug #43756 Proxy cache does not reload lua script when file is touched
Submitted: 19 Mar 2009 17:47 Modified: 23 Mar 2009 19:02
Reporter: Diego Medina Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Enterprise Monitor: Agent Severity:S3 (Non-critical)
Version:2.1.0.1018 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: mysqlproxy

[19 Mar 2009 17:47] Diego Medina
Description:
The proxy caches the lua script it uses, and if the lua script is modified, you do not need to restart the proxy, all new connections will use the new lua script.

This is not the case if you use "modules"

When the modules are modified, you are force to restart the proxy for these new changes to take effect.

How to repeat:
1- Install the agent
2- Download the two Lua scripts I will attach
3- Start the mysql proxy (not the agent) like this:

$ LUA_PATH=/path/to/bugs/?.lua     /Applications/mysql/enterprise/gpl-mysql-proxy/sbin/mysql-proxy --proxy-address=:4040 --proxy-backend-addresses=127.0.0.1:5130 --proxy-lua-script=/Users/wizard/Desktop/work/bugs/main.lua

4- on a new terminal start a connection to port 4040

$ mysql -h127.0.0.1 -umsandbox -pmsandbox  -P4040

5- Go back to the terminal where the proxy was started and you will see a message
"I'm  here"
6- Modify the bugs/modules/modulefile.lua script to print something else
7- exit the mysql client connection and start it again.
8- Go to the proxy terminal and the "old" message will keep printing.
[19 Mar 2009 18:09] Diego Medina
files for this bug report

Attachment: bugs.zip (application/x-zip, text), 784 bytes.

[19 Mar 2009 18:12] Kay Roepke
We cannot easily check for all modules, as we only stat() the script file itself.
If you modify a module required by the script you need to touch the script file as well.

Otherwise we would have to track each and every require, even in submodules.

I'm tempted to set this to Not A Bug.
[19 Mar 2009 18:25] Diego Medina
If it gets to the point where we decide not to "change it" could we at least document it?
[19 Mar 2009 18:29] Kay Roepke
That's the best option, yes.

Please check that a touch on the script file causes the expected behavior.
[23 Mar 2009 19:02] Diego Medina
I tried these two commands and opening a new connection through the proxy still used the "old code"

$ touch Desktop/work/bugs/bugs/modules/modulefile.lua 
$ touch Desktop/work/bugs/bugs/main.lua 

I have to modify the main.lua script by adding a word or something to cause the proxy to reload the new code.
[28 Apr 2009 18:37] Mark Matthews
Until we've got an admin module w/ functionality to offer "reload", touch and/or kill -HUP should both be supported. It appears they are not, currently?
[24 Jun 2009 20:51] Mark Leith
This would also be desirable for the XML collections files as well - so that new custom collections can be picked up. 

Please consider that too when resolving this bug.