jsxc / prosody-cloud-roster

MIT License
5 stars 0 forks source link

Error Initializing - attempt to set a global #4

Open averyjparker opened 5 years ago

averyjparker commented 5 years ago

I'm trying to load the module, have the config variables set (I think) as they should be but on the prosody restart I see the following in the logfile.

Dec 04 01:32:49 modulemanager error Error initializing module 'roster_cloud' on 'im.domain.org': /usr/share/lua/5.2/ltn12.lua:15: Attempt to set a global: ltn12 = table: 0x203fa70 ...ib/prosody/modules/mod_roster_cloud/mod_roster_cloud.lua:1: in main chunk

Any ideas?

MarcelWaldvogel commented 5 years ago

Could it be that you do not have lua-socket available?

averyjparker commented 5 years ago

Hmmm.. it appears to be there.

apt install lua-socket Reading package lists... Done Building dependency tree
Reading state information... Done lua-socket is already the newest version (3.0~rc1+git+321c0c9-1).

This is on an ubuntu 16.0.4.5 system btw.

averyjparker commented 5 years ago

Here's the full output in prosody.err

Dec 15 23:21:22 modulemanager error Error initializing module 'roster_cloud' on 'im.domain.org': /usr/share/lua/5.2/ltn12.lua:15: Attempt to set a global: ltn12 = table: 0xbe7460 stack traceback: [C]: in function 'error' /usr/lib/prosody/util/startup.lua:336: in function '__newindex' /usr/share/lua/5.2/ltn12.lua:15: in main chunk [C]: in function '_real_require' /usr/lib/prosody/util/startup.lua:141: in function 'require' /usr/share/lua/5.2/ssl/https.lua:11: in main chunk [C]: in function '_real_require' /usr/lib/prosody/util/startup.lua:141: in function 'require' ...ib/prosody/modules/mod_roster_cloud/mod_roster_cloud.lua:1: in main chunk [C]: in function 'xpcall' /usr/lib/prosody/core/modulemanager.lua:178: in function 'do_load_module' /usr/lib/prosody/core/modulemanager.lua:256: in function 'load' /usr/lib/prosody/core/modulemanager.lua:78: in function '?' /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/core/hostmanager.lua:108: in function 'activate' /usr/lib/prosody/core/hostmanager.lua:58: in function '?' /usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75> (...tail calls...) /usr/lib/prosody/util/startup.lua:327: in function 'prepare_to_start' /usr/lib/prosody/util/startup.lua:548: in function 'f' /usr/lib/prosody/util/async.lua:139: in function 'func' /usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125>

MarcelWaldvogel commented 5 years ago

Thanks for the dump, that gives an entirely new perspective:

/usr/share/lua/5.2/ltn12.lua:15: Attempt to set a global: ltn12 = table: 0xbe7460

That means that ltn12.lua is executing, but cannot assign itself to the global variable. This seems to refer to the indented line in this code (Ubuntu 18.10):

local _M = {}
if module then -- heuristic for exporting a global package table
    ltn12 = _M
end

Why this does not work exceeds my meagre Lua/Prosody know-how (and a web search for the error message didn't reveal anything helpful, either).

Can anyone with more Lua/Prosody know-how help here? E.g. @DanScharon?