ionelmc / python-redis-lock

Lock context manager implemented via redis SET NX EX and BLPOP.
https://pypi.python.org/pypi/python-redis-lock
BSD 2-Clause "Simplified" License
550 stars 78 forks source link

test_no_overlap2[decode_responses=False] fails #86

Open mcepl opened 3 years ago

mcepl commented 3 years ago

When packaging this package for openSUSE/Factory I get this error:

[   54s] + pytest-3.6 --ignore=_build.python36 --ignore=_build.python38 -v
[   57s] ============================= test session starts ==============================
[   57s] platform linux -- Python 3.6.13, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3.6
[   57s] cachedir: .pytest_cache
[   57s] django: settings: test_project.settings (from env)
[   57s] rootdir: /home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0, configfile: setup.cfg, testpaths: tests
[   57s] plugins: django-4.1.0
[   57s] collecting ... collected 90 items

...

[  234s] ___________________ test_no_overlap2[decode_responses=False] ___________________
[  234s] tests/test_redis_lock.py:400: in test_no_overlap2
[  234s]     assert count.value == 1
[  234s] E   assert 0 == 1
[  234s] E     +0
[  234s] E     -1
[  234s] --------------------------- Captured stderr teardown ---------------------------
[  234s] Process Process-237:
[  234s] Process Process-230:
[  234s] Process Process-218:
[  234s] Process Process-243:
[  234s] Process Process-148:
[  234s] Process Process-204:
[  234s] Traceback (most recent call last):
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  234s]     self.run()
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  234s]     self._target(*self._args, **self._kwargs)
[  234s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  234s]     if redis_lock.acquire(blocking=True):
[  234s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  234s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  234s]     return self.execute_command('BLPOP', *keys)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  234s]     return self.parse_response(conn, command_name, **options)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  234s]     response = connection.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  234s]     response = self._parser.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  234s]     raw = self._buffer.readline()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  234s]     self._read_from_socket()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  234s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  234s] redis.exceptions.ConnectionError: Connection closed by server.
[  234s] Process Process-232:
[  234s] Process Process-145:
[  234s] Traceback (most recent call last):
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  234s]     self.run()
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  234s]     self._target(*self._args, **self._kwargs)
[  234s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  234s]     if redis_lock.acquire(blocking=True):
[  234s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  234s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  234s]     return self.execute_command('BLPOP', *keys)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  234s]     return self.parse_response(conn, command_name, **options)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  234s]     response = connection.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  234s]     response = self._parser.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  234s]     raw = self._buffer.readline()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  234s]     self._read_from_socket()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  234s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  234s] redis.exceptions.ConnectionError: Connection closed by server.
[  234s] Process Process-240:
[  234s] Process Process-153:
[  234s] Traceback (most recent call last):
[  234s] Traceback (most recent call last):
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  234s]     self.run()
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  234s]     self.run()
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  234s]     self._target(*self._args, **self._kwargs)
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  234s]     self._target(*self._args, **self._kwargs)
[  234s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  234s]     if redis_lock.acquire(blocking=True):
[  234s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  234s]     if redis_lock.acquire(blocking=True):
[  234s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  234s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  234s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  234s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  234s]     return self.execute_command('BLPOP', *keys)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  234s]     return self.execute_command('BLPOP', *keys)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  234s]     return self.parse_response(conn, command_name, **options)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  234s]     return self.parse_response(conn, command_name, **options)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  234s]     response = connection.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  234s]     response = connection.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  234s]     response = self._parser.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  234s]     response = self._parser.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  234s]     raw = self._buffer.readline()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  234s]     raw = self._buffer.readline()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  234s]     self._read_from_socket()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  234s]     self._read_from_socket()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  234s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  234s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  234s] redis.exceptions.ConnectionError: Connection closed by server.
[  234s] redis.exceptions.ConnectionError: Connection closed by server.
[  234s] Process Process-226:
[  234s] Process Process-189:
[  234s] Traceback (most recent call last):
[  234s] Traceback (most recent call last):
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  234s]     self.run()
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  234s]     self.run()
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  234s]     self._target(*self._args, **self._kwargs)
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  234s]     self._target(*self._args, **self._kwargs)
[  234s] Process Process-197:
[  234s] Process Process-158:
[  234s] Process Process-241:
[  234s] Process Process-190:
[  234s] Process Process-156:
[  234s] Traceback (most recent call last):
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  234s]     self.run()
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  234s]     self._target(*self._args, **self._kwargs)
[  234s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  234s]     if redis_lock.acquire(blocking=True):
[  234s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  234s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  234s]     return self.execute_command('BLPOP', *keys)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  234s]     return self.parse_response(conn, command_name, **options)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  234s]     response = connection.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  234s]     response = self._parser.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  234s]     raw = self._buffer.readline()
[  234s] Process Process-235:
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  234s]     self._read_from_socket()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  234s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  234s] redis.exceptions.ConnectionError: Connection closed by server.
[  234s] Traceback (most recent call last):
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  234s]     self.run()
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  234s]     self._target(*self._args, **self._kwargs)
[  234s] Process Process-234:
[  234s] Process Process-161:
[  234s] Process Process-143:
[  234s] Traceback (most recent call last):
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  234s]     self.run()
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  234s]     self._target(*self._args, **self._kwargs)
[  234s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  234s]     if redis_lock.acquire(blocking=True):
[  234s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  234s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  234s]     return self.execute_command('BLPOP', *keys)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  234s]     return self.parse_response(conn, command_name, **options)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  234s]     response = connection.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  234s]     response = self._parser.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  234s]     raw = self._buffer.readline()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  234s]     self._read_from_socket()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  234s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  234s] redis.exceptions.ConnectionError: Connection closed by server.
[  234s] Process Process-214:
[  234s] Traceback (most recent call last):
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  234s]     self.run()
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  234s]     self._target(*self._args, **self._kwargs)
[  234s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  234s]     if redis_lock.acquire(blocking=True):
[  234s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  234s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  234s]     return self.execute_command('BLPOP', *keys)
[  234s] Traceback (most recent call last):
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  234s]     return self.parse_response(conn, command_name, **options)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  234s]     response = connection.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  234s]     response = self._parser.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  234s]     raw = self._buffer.readline()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  234s]     self._read_from_socket()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  234s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  234s]     self.run()
[  234s] redis.exceptions.ConnectionError: Connection closed by server.
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  234s]     self._target(*self._args, **self._kwargs)
[  234s] Process Process-248:
[  234s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  234s]     if redis_lock.acquire(blocking=True):
[  234s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  234s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  234s]     return self.execute_command('BLPOP', *keys)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  234s]     return self.parse_response(conn, command_name, **options)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  234s]     response = connection.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  234s]     response = self._parser.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  234s]     raw = self._buffer.readline()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  234s]     self._read_from_socket()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  234s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  234s] redis.exceptions.ConnectionError: Connection closed by server.
[  234s] Traceback (most recent call last):
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  234s]     self.run()
[  234s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  234s]     self._target(*self._args, **self._kwargs)
[  234s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  234s]     if redis_lock.acquire(blocking=True):
[  234s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  234s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  234s]     return self.execute_command('BLPOP', *keys)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  234s]     return self.parse_response(conn, command_name, **options)
[  234s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  234s]     response = connection.read_response()
[  234s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  235s]     response = self._parser.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  235s]     raw = self._buffer.readline()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  235s]     self._read_from_socket()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  235s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  235s] redis.exceptions.ConnectionError: Connection closed by server.
[  235s] Process Process-229:
[  235s] Process Process-201:
[  235s] Traceback (most recent call last):
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  235s]     self.run()
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  235s]     self._target(*self._args, **self._kwargs)
[  235s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  235s]     if redis_lock.acquire(blocking=True):
[  235s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  235s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  235s]     return self.execute_command('BLPOP', *keys)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  235s]     return self.parse_response(conn, command_name, **options)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  235s]     response = connection.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  235s]     response = self._parser.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  235s]     raw = self._buffer.readline()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  235s]     self._read_from_socket()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  235s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  235s] redis.exceptions.ConnectionError: Connection closed by server.
[  235s] Traceback (most recent call last):
[  235s] Traceback (most recent call last):
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  235s]     self.run()
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  235s]     self._target(*self._args, **self._kwargs)
[  235s] Process Process-149:
[  235s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  235s]     if redis_lock.acquire(blocking=True):
[  235s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  235s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  235s]     return self.execute_command('BLPOP', *keys)
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  235s]     self.run()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  235s]     return self.parse_response(conn, command_name, **options)
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  235s]     self._target(*self._args, **self._kwargs)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  235s]     response = connection.read_response()
[  235s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  235s]     if redis_lock.acquire(blocking=True):
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  235s]     response = self._parser.read_response()
[  235s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  235s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  235s]     raw = self._buffer.readline()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  235s]     return self.execute_command('BLPOP', *keys)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  235s]     self._read_from_socket()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  235s]     return self.parse_response(conn, command_name, **options)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  235s]     response = connection.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  235s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  235s]     response = self._parser.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  235s]     raw = self._buffer.readline()
[  235s] redis.exceptions.ConnectionError: Connection closed by server.
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  235s]     self._read_from_socket()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  235s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  235s] redis.exceptions.ConnectionError: Connection closed by server.
[  235s] Process Process-221:
[  235s] Process Process-133:
[  235s] Traceback (most recent call last):
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  235s]     self.run()
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  235s]     self._target(*self._args, **self._kwargs)
[  235s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  235s]     if redis_lock.acquire(blocking=True):
[  235s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  235s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  235s]     return self.execute_command('BLPOP', *keys)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  235s]     return self.parse_response(conn, command_name, **options)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  235s]     response = connection.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  235s]     response = self._parser.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  235s]     raw = self._buffer.readline()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  235s]     self._read_from_socket()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  235s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  235s] redis.exceptions.ConnectionError: Connection closed by server.
[  235s] Traceback (most recent call last):
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  235s]     self.run()
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  235s]     self._target(*self._args, **self._kwargs)
[  235s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  235s]     if redis_lock.acquire(blocking=True):
[  235s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  235s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  235s]     return self.execute_command('BLPOP', *keys)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  235s]     return self.parse_response(conn, command_name, **options)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  235s]     response = connection.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  235s]     response = self._parser.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  235s]     raw = self._buffer.readline()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  235s]     self._read_from_socket()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  235s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  235s] redis.exceptions.ConnectionError: Connection closed by server.
[  235s] Traceback (most recent call last):
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  235s]     self.run()
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  235s]     self._target(*self._args, **self._kwargs)
[  235s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  235s]     if redis_lock.acquire(blocking=True):
[  235s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  235s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  235s]     return self.execute_command('BLPOP', *keys)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  235s]     return self.parse_response(conn, command_name, **options)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  235s]     response = connection.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  235s]     response = self._parser.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  235s]     raw = self._buffer.readline()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  235s]     self._read_from_socket()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  235s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  235s] redis.exceptions.ConnectionError: Connection closed by server.
[  235s] Traceback (most recent call last):
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
[  235s]     self.run()
[  235s]   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
[  235s]     self._target(*self._args, **self._kwargs)
[  235s]   File "/home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py", line 380, in workerfn
[  235s]     if redis_lock.acquire(blocking=True):
[  235s]   File "/home/abuild/rpmbuild/BUILDROOT/python-python-redis-lock-3.6.0-2.3.x86_64/usr/lib/python3.6/site-packages/redis_lock/__init__.py", line 235, in acquire
[  235s]     timed_out = not self._client.blpop(self._signal, blpop_timeout) and timeout
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 1900, in blpop
[  235s]     return self.execute_command('BLPOP', *keys)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 901, in execute_command
[  235s]     return self.parse_response(conn, command_name, **options)
[  235s]   File "/usr/lib/python3.6/site-packages/redis/client.py", line 915, in parse_response
[  235s]     response = connection.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 739, in read_response
[  235s]     response = self._parser.read_response()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 324, in read_response
[  235s]     raw = self._buffer.readline()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 256, in readline
[  235s]     self._read_from_socket()
[  235s]   File "/usr/lib/python3.6/site-packages/redis/connection.py", line 201, in _read_from_socket
[  235s]     raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
[  235s] redis.exceptions.ConnectionError: Connection closed by server.
[  235s] Process Process-212:
[  235s] =============================== warnings summary ===============================
[  235s] ../../../../../usr/lib/python3.6/site-packages/_pytest/config/__init__.py:1184
[  235s]   /usr/lib/python3.6/site-packages/_pytest/config/__init__.py:1184: PytestDeprecationWarning: The --strict option is deprecated, use --strict-markers instead.
[  235s]     _pytest.deprecated.STRICT_OPTION, stacklevel=2
[  235s] 
[  235s] tests/conftest.py:12
[  235s]   /home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/conftest.py:12: PytestDeprecationWarning: @pytest.yield_fixture is deprecated.
[  235s]   Use @pytest.fixture instead; they are the same.
[  235s]     def redis_server(scope='session'):
[  235s] 
[  235s] tests/test_redis_lock.py:42
[  235s]   /home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/test_redis_lock.py:42: PytestDeprecationWarning: @pytest.yield_fixture is deprecated.
[  235s]   Use @pytest.fixture instead; they are the same.
[  235s]     def redis_server(scope='module'):
[  235s] 
[  235s] -- Docs: https://docs.pytest.org/en/stable/warnings.html
[  235s] =========================== short test summary info ============================
[  235s] FAILED tests/test_redis_lock.py::test_no_overlap2[decode_responses=False] - a...
[  235s] ============= 1 failed, 89 passed, 3 warnings in 176.89s (0:02:56) =============

Complete build log with all details and versions of all packages used.

ionelmc commented 3 years ago

Are there some memory limits or something that may make the redis server close connections?

mcepl commented 3 years ago

Yes, probably, but they should be pretty high: my computer has 15 GB RAM, 700+ MB free, and there are some constraints in the build system, but those should be again in GBs of RAM.

ionelmc commented 3 years ago

Maybe you have some file descriptor limits that create that disconnect problem?

mcepl commented 3 years ago

Maybe you have some file descriptor limits that create that disconnect problem?

$ ulimit -a
real-time non-blocking time  (microseconds, -R) unlimited
core file size              (blocks, -c) unlimited
data seg size               (kbytes, -d) unlimited
scheduling priority                 (-e) 0
file size                   (blocks, -f) unlimited
pending signals                     (-i) 63393
max locked memory           (kbytes, -l) 64
max memory size             (kbytes, -m) unlimited
open files                          (-n) 1024
pipe size                (512 bytes, -p) 8
POSIX message queues         (bytes, -q) 819200
real-time priority                  (-r) 0
stack size                  (kbytes, -s) 8192
cpu time                   (seconds, -t) unlimited
max user processes                  (-u) 63393
virtual memory              (kbytes, -v) unlimited
file locks                          (-x) unlimited
$
ionelmc commented 3 years ago

open files = 1024 is not really adequate, there'd be lots of fd trashing in the ton of integration tests that PRL has.

mcepl commented 3 years ago

open files = 1024 is not really adequate, there'd be lots of fd trashing in the ton of integration tests that PRL has.

Rising the value to 63393 doesn't seem to help too much.

ionelmc commented 3 years ago

Well there's something weird going on. I'd need to change a bit the tests to dump out the redis logs. But you're the only one able to reproduce this problem so I must ask if this is really worth pursuing - running integration tests in a build system...

mcepl commented 3 years ago

On the one hand of course adding one exception to pytest call is not a big deal. On the other hand, I like to run as many tests as possible to (hopefully) avoid too many regressions. I can understand if it is just not possible to fix this, I just wonder.

ionelmc commented 3 years ago

Well it's suspicious that it fails just that one test (I hope you have tried to run the tests at least a dozen times). I'm not saying it's not possible to fix (or better said, to figure out why it happens), but it'll take time. CI passed 20 days ago (https://travis-ci.org/ionelmc/python-redis-lock) so I asked if it's worth spending the time.

mcepl commented 3 years ago

It is probably not. Just leave this ticket open, and it can be fixed anytime.

ionelmc commented 3 years ago

It's up to you ;-)

Try this patch:

diff --git a/tests/test_redis_lock.py b/tests/test_redis_lock.py
index 5d91e8e..0915543 100644
--- a/tests/test_redis_lock.py
+++ b/tests/test_redis_lock.py
@@ -364,7 +364,7 @@ NWORKERS = 125

 @pytest.mark.skipif(platform.python_implementation() == 'PyPy', reason="This appears to be way too slow to run on PyPy")
-def test_no_overlap2(make_process, make_conn):
+def test_no_overlap2(make_process, make_conn, redis_server):
     """The second version of contention test, that uses multiprocessing."""
     go = multiprocessing.Event()
     count_lock = multiprocessing.Lock()
@@ -397,6 +397,7 @@ def test_no_overlap2(make_process, make_conn):

     time.sleep(1)

+    print(redis_server.read())
     assert count.value == 1
mcepl commented 3 years ago

_log.txt

The relevant part is probably:

[  197s] redis_server = 6403:C 25 Mar 2021 20:17:24.669 # oO0OoO0OoO0Oo Redis is starting o
O0OoO0OoO0Oo
[  197s] 6403:C 25 Mar 2021 20:17:24.669 # Redis version=6.2.1, bits=64, commit=00000000, m
odified=0, pid=6403, just started
[  197s] 6403:C 25 Mar 2021 20:17:24.669 # Configuration loaded
[  197s] 6403:M 25 Mar 2021 20:17:24.669 * monotonic clock: POSIX clock_gettime
[  197s] 6403:M 25 Mar 2021 20:17:24.669 * Running mode=standalone, port=0.
[  197s] 6403:M 25 Mar 2021 20:17:24.669 # Server initialized
[  197s] 6403:M 25 Mar 2021 20:17:24.670 * Loading RDB produced by version 6.2.1
[  197s] 6403:M 25 Mar 2021 20:17:24.670 * RDB age 0 seconds
[  197s] 6403:M 25 Mar 2021 20:17:24.670 * RDB memory usage when created 3.27 Mb
[  197s] 6403:M 25 Mar 2021 20:17:24.670 * DB loaded from disk: 0.000 seconds
[  197s] 6403:M 25 Mar 2021 20:17:24.670 * The server is now ready to accept connections at
 /tmp/redis-lock-tests.sock

By the way, talking about complicated and non-complicated fixes:

[  197s]   /home/abuild/rpmbuild/BUILD/python-redis-lock-3.6.0/tests/conftest.py:12: Pytest
DeprecationWarning: @pytest.yield_fixture is deprecated.
[  197s]   Use @pytest.fixture instead; they are the same.
[  197s]     def redis_server(scope='session'):
Bubu commented 2 years ago

I'm also getting this now in Archlinux. (And Nix apperently as well as can be seen above).

This didn't happen when I built the package on Fri 11 Dec 2020, so there might be some change in the ecosystem between Dec 2020 and Mar '21. :thinking:

Bubu commented 1 year ago

I just upgraded the archlinux package to 4.0.0. The test in question here passed with no problems.