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

symbol not found in flat namespace (_luaL_loadbuffer) on mac with m1 #216

Closed
yawhide opened this issue Aug 3, 2022 · 1 comment
Closed

Comments

@yawhide
Copy link

yawhide commented Aug 3, 2022

Howdy. Got an issue with lupa not finding a symbol. Hoping to get some help on how to resolve this.

Stacktrace:

../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/redis_lock/__init__.py:361: in release
    error = self.unlock_script(client=self._client, keys=(self._name, self._signal), args=(self._id, self._signal_expire))
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/redis/commands/core.py:4440: in __call__
    return client.evalsha(self.sha, len(keys), *args)
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/redis/commands/core.py:3891: in evalsha
    return self.execute_command("EVALSHA", sha, numkeys, *keys_and_args)
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/ddtrace/contrib/redis/patch.py:68: in traced_execute_command
    return func(*args, **kwargs)
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/redis/client.py:1176: in execute_command
    return conn.retry.call_with_retry(
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/redis/retry.py:45: in call_with_retry
    return do()
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/redis/client.py:1177: in <lambda>
    lambda: self._send_command_parse_response(
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/redis/client.py:1152: in _send_command_parse_response
    conn.send_command(*args)
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/redis/connection.py:795: in send_command
    self.send_packed_command(
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/redis/connection.py:777: in send_packed_command
    self._sock.sendall(item)
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/fakeredis/_fakesocket.py:216: in sendall
    self._parser.send(data)
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/fakeredis/_fakesocket.py:128: in _parse_commands
    self._process_command(fields)
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/fakeredis/_fakesocket.py:246: in _process_command
    result = self._run_command(func, sig, fields[1:], False)
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/fakeredis/_fakesocket.py:149: in _run_command
    result = func(*args)
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/fakeredis/_fakesocket.py:1988: in evalsha
    return self.eval(script, numkeys, *keys_and_args)
../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/fakeredis/_fakesocket.py:1931: in eval
    from lupa import LuaError, LuaRuntime, as_attrgetter
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    from __future__ import absolute_import


    # We need to enable global symbol visibility for lupa in order to
    # support binary module loading in Lua.  If we can enable it here, we
    # do it temporarily.

    def _try_import_with_global_library_symbols():
        try:
            from os import RTLD_NOW, RTLD_GLOBAL
        except ImportError:
            from DLFCN import RTLD_NOW, RTLD_GLOBAL  # Py2.7
        dlopen_flags = RTLD_NOW | RTLD_GLOBAL

        import sys
        old_flags = sys.getdlopenflags()
        try:
            sys.setdlopenflags(dlopen_flags)
            import lupa._lupa
        finally:
            sys.setdlopenflags(old_flags)

    try:
        _try_import_with_global_library_symbols()
    except:
        pass

    del _try_import_with_global_library_symbols

    # the following is all that should stay in the namespace:

>   from lupa._lupa import *
E   ImportError: dlopen(/Users/happy/Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/lupa/_lupa.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace (_luaL_loadbuffer)

../../../Library/Caches/pypoetry/virtualenvs/workstuff-IU-yuaqp-py3.9/lib/python3.9/site-packages/lupa/__init__.py:32: ImportError

The code in question that is causing the issue is using python-redis-lock in a test case using fakeredis with a lupa extra.

Running python 3.9.9, lupa 1.13

thanks

@scoder
Copy link
Owner

scoder commented Aug 3, 2022

Duplicate of #191.

@scoder scoder closed this as completed Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants