3

I need to ask a question on creating UDF on aerospike. My configuration is as below:

  • M1 Macbook Pro
  • Docker using latest aerospike

My application is running this code:

AerospikeClient.RegisterUDF(nil, []byte({UDF_BODY}), {UDF_FILENAME}+".lua", aerospike.LUA)

and it keeps on producing this error:

Error registering UDF in aerospike.     common_error="Registration failed: compile_error\nFile: \nLine: 0\nMessage: Unable to create a new Lua state"

Does anybody have any idea on how to resolve this error?

I searched the forum and I don't think there is anybody that have encountered the same issue as me.

Thanks

1 Answers1

2

The error message itself comes from aerospike/aerospike-mod-lua/src/main/mod_lua.c#validate(), relayed by aerospike/aerospike-client-go/client.go#RegisterUDF()

Considering the filename is empty in the error message, it makes sense it triggers from the code, because lua_open() returns null, which has been seen before as a linking option issue.
In that page, lua_open() is a macro for luaL_newstate(), and this error could reflect the fact the M1 support for luajit is not yet fully completed.

The OP David Budiman confirms in the comments:

My teammates that are not using M1 macbook do not encounter this problem. I'll try to use another machine first

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Okay, I tried your suggestion. I put the filename on the server path argument. But, the same error still pops up. Was the filename supposed to be on another argument? – David Budiman Nov 29 '21 at 07:38
  • @DavidBudiman Not sure: maybe this is due to the lack of full M1 support, as I mention in my answer? – VonC Nov 29 '21 at 11:39
  • 1
    Maybe, my teammate that are not using M1 macbook do not encounter this problem. I'll try to use another machine first – David Budiman Nov 30 '21 at 04:39
  • it seems that the lack of M1 support for LuaJIT really is the cause of this issue. Because of that, I'll accept your answer since you do answer the problem – David Budiman Dec 06 '21 at 02:11
  • @DavidBudiman No problem. Welcome to Stack Overflow. – VonC Dec 06 '21 at 07:27