aredis icon indicating copy to clipboard operation
aredis copied to clipboard

Exception: AttributeError: 'list' object has no attribute 'decode'

Open faynburd opened this issue 3 years ago • 1 comments

Checklist

  • Python version 3.9.7
  • Using hiredis 2.0.0
  • Using uvloop 0.16.0
  • Does issue exists against the master branch of aredis? - yes

Steps to reproduce

From time to time we're getting error list' object has no attribute 'decode' This is the stack File "/usr/local/lib/python3.9/site-packages/aredis/commands/strings.py", line 210, in mset return await self.execute_command('MSET', *items) File "/usr/local/lib/python3.9/site-packages/aredis/client.py", line 156, in execute_command return await self.parse_response(connection, command_name, **options) File "/usr/local/lib/python3.9/site-packages/aredis/client.py", line 175, in parse_response return callback(response, **options) File "/usr/local/lib/python3.9/site-packages/aredis/utils.py", line 91, in bool_ok return nativestr(response) == 'OK' File "/usr/local/lib/python3.9/site-packages/aredis/utils.py", line 25, in nativestr return x if isinstance(x, str) else x.decode('utf-8', 'replace') AttributeError: 'list' object has no attribute 'decode'

Expected behavior

Not throwing exceptions on MSET command

Actual behavior

Throwing exception with the above stack - probably in some race or timeout/disconnect situation (pretty rare - once a 10K requests)

faynburd avatar Jun 01 '22 19:06 faynburd

Hello,

I have experienced the same issue in a high load situation. Using a single client does not appear to be safe in high load situation, as results will appear out of order.

I switched to using aioredis (very similar API) and has the issue disappear. Using a connection pool in aredis may also be an option, but this library does not appear to be maintained anyway.

eirikrye avatar Oct 21 '22 15:10 eirikrye