UDF module bug


#1

We have 4 node cluster. I setup end start new indentical node(5).

After start node print to log

[20:04:47] Igor Kochergin: Nov 13 2014 17:02:36 GMT: WARNING (udf): (src/main/mod_lua.c::585) Lua Create Error: module 'module' not found:
	no field package.preload['module']
	no file './module.lua'
	no file '/usr/local/share/lua/5.1/module.lua'
	no file '/usr/local/share/lua/5.1/module/init.lua'
	no file '/usr/local/lib/lua/5.1/module.lua'
	no file '/usr/local/lib/lua/5.1/module/init.lua'
	no file '/opt/aerospike/sys/udf/lua/module.lua'
	no file '/opt/aerospike/sys/udf/lua/external/module.lua'
	no file '/opt/aerospike/usr/udf/lua/module.lua'
	no file './module.so'
	no file '/usr/local/lib/lua/5.1/module.so'
	no file '/usr/local/lib/lua/5.1/loadall.so'
	no file '/opt/aerospike/sys/udf/lua/module.so'
	no file '/opt/aerospike/sys/udf/lua/external/module.so'
	no file '/opt/aerospike/usr/udf/lua/module.so'
Nov 13 2014 17:02:36 GMT: INFO (udf): (udf_rw.c::602) lua error, ret:1

a lot of messages.

I stop node and check that the file is present in /opt/aerospike/usr/udf/lua/module.lua.

Then i start aerospike node again. Restarting occurred without errors and node normally added to cluster.

AS 3.3.19


#2

Thanks for reaching out. Following up internally on this one.


#3

Hi. How did you introduce the Lua file to the cluster? And, how long did you wait before trying to use it?

It’s possible that you hit that window between registering the UDF and it being ready on all of the cluster nodes.

Aerospike uses SMD to register resources (like Lua UDFs), and it takes a moment for the UDF files to propagate to all of the nodes. Generally, we try to register our UDFs a second or two before we try to use them.


#4

Hi I talk to our developers.

We load module on our service start with c client code:

std::string scriptSrc = 
    "function storeImpressionContext(rec, value, new_ttl)\n"
        "if aerospike:exists(rec) then\n"
            "local ttl = record.ttl(rec);\n"
            "if new_ttl > 0 and ttl > new_ttl then\n"
                "return 'decr_ttl';\n"
            "end;\n"
            "rec.ic = value;\n"
            "record.set_ttl(rec, new_ttl);\n"
            "aerospike:update(rec);\n"
        "else\n"
            "rec.ic = value;\n"
            "record.set_ttl(rec, new_ttl);\n"
            "aerospike:create(rec);\n"
        "end;\n"
        "return 'ok';\n"
    "end";
for (auto& aerospike : aerospikies_) {
    if (!aerospike->loadScriptSync("module.lua", scriptSrc)) {
        return false;
    }
}

We wait “ok” from aerospike аnd when use module.

But when i start new node, all services have worked a few hours and the module has been loaded (registered) for a long time.

I assume that at the start of a new node, the module does not have load from the cluster prior to connecting clients.

Thanks