seomoz / qless-core

Core Lua Scripts for qless
MIT License
85 stars 33 forks source link

Fails on redis 6.2.7 and redis 7.0 due to globally reachable lua tables becoming read only #89

Open bak1an opened 2 years ago

bak1an commented 2 years ago

docker run -it --rm -p 127.0.0.1:6379:6379 redis:6.2.7 and make test fails all tests due to tables becoming read only:

...
======================================================================
FAIL: Cannot fail a job that doesn't exist
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/test/qless-core/test/test_fail.py", line 84, in test_fail_nonexistent
    self.lua, 'fail', 1, 'jid', 'worker', 'group', 'message', {})
  File "/home/test/qless-core/test/common.py", line 41, in assertRaisesRegexp
    '%s does not match %s' % (str(exc), regex))
AssertionError: Error running script (call to f_1c4a4e283c4a97440f92a680b4aa0c4c070ee1e9): @user_script:27: user_script:27: Attempt to modify a readonly table does not match does not exist

======================================================================
FAIL: Cannot complete a job that doesn't exist
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/test/qless-core/test/test_job.py", line 99, in test_complete_nonexistent
    self.lua, 'complete', 1, 'jid', 'worker', 'queue', {})
  File "/home/test/qless-core/test/common.py", line 41, in assertRaisesRegexp
    '%s does not match %s' % (str(exc), regex))
AssertionError: Error running script (call to f_1c4a4e283c4a97440f92a680b4aa0c4c070ee1e9): @user_script:27: user_script:27: Attempt to modify a readonly table does not match does not exist
...
Ran 243 tests in 0.368s

FAILED (errors=220, failures=6)

Same with redis 7.

With 6.2.6 and prior releases it still works.

Related redis PR: https://github.com/redis/redis/pull/10651

Have not used lua before, not sure what would be the proper way to workaround that.