Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solved an error caused by LuaSocket by allowing it to pollute the global variables. #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FatihMalakci
Copy link

@FatihMalakci FatihMalakci commented Jul 13, 2021

Prosody was throwing me this error when I use this module :


Jul 13 18:30:27 modulemanager   error   Error initializing module 'auth_privacyidea' on 'jitest.fatihmalakci.com': /usr/local/share/lua/5.2/ltn12.lua:16: Attempt to set a global: ltn12 = table: 0x562b4449dde0
stack traceback:
        [C]: in function 'error'
        /usr/lib/prosody/util/startup.lua:339: in function '__newindex'
        /usr/local/share/lua/5.2/ltn12.lua:16: in main chunk
        [C]: in function '_real_require'
        /usr/lib/prosody/util/startup.lua:144: 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:144: in function 'require'
        /usr/lib/prosody/modules/mod_auth_privacyidea.lua:13: 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/usermanager.lua:67: 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:330: in function 'prepare_to_start'
        /usr/lib/prosody/util/startup.lua:551: 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>

This error happens because LuaSocket tries to pollute global variables but it can't, by unlocking globals before importing the luasockets and locking afterwards I managed to solve the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant