yahoo/redislite

logging in `__del__` is not reliable

graingert opened this issue · 1 comments

[2020-07-31T11:31:18.114Z] --- Logging error ---
[2020-07-31T11:31:18.114Z] Traceback (most recent call last):
[2020-07-31T11:31:18.114Z]   File "/usr/lib/python3.8/logging/__init__.py", line 1084, in emit
[2020-07-31T11:31:18.114Z]     stream.write(msg + self.terminator)
[2020-07-31T11:31:18.114Z]   File "/opt/001-python/lib/python3.8/site-packages/_pytest/capture.py", line 441, in write
[2020-07-31T11:31:18.114Z]     self.buffer.write(obj)
[2020-07-31T11:31:18.114Z] ValueError: I/O operation on closed file
[2020-07-31T11:31:18.114Z] Call stack:
[2020-07-31T11:31:18.114Z]   File "/opt/001-python/lib/python3.8/site-packages/redislite/client.py", line 83, in _cleanup
[2020-07-31T11:31:18.114Z]     logger.debug(
[2020-07-31T11:31:18.115Z] Message: 'Shutting down redis server with pid of %r'
[2020-07-31T11:31:18.115Z] Arguments: (18113,)
[2020-07-31T11:31:18.115Z] --- Logging error ---

also note that redis-py v4 will enforce explicit resource management: https://github.com/andymccurdy/redis-py/blob/master/CHANGES#L16-L17