question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HGETALL return long type value

See original GitHub issue

I deployed a redis cluster with six nodes. And saved a hashmap into it. All redis.conf “timeout” options is 600. All logical are working as expected when my app connect to this cluster using redis-py-cluster. But after one night, I got the following exception( it is a part of the traceback).

NOTE: I have retried to get this key by redis-cli, it is OK. And I checked all redis cluster nodes log(debug level), no error and warning message found.

res = self.redis_conn.hgetall(res_id)
File "/opt/ksc_lbaas/.venv/lib/python2.7/site-packages/redis/client.py", line 1861, in hgetall
  return self.execute_command('HGETALL', name)
File "/opt/ksc_lbaas/.venv/lib/python2.7/site-packages/rediscluster/utils.py", line 93, in inner
  return func(*args, **kwargs)
File "/opt/ksc_lbaas/.venv/lib/python2.7/site-packages/rediscluster/client.py", line 309, in execute_command
  return self.parse_response(r, command, **kwargs)
File "/opt/ksc_lbaas/.venv/lib/python2.7/site-packages/redis/client.py", line 587, in parse_response
  return self.response_callbacks[command_name](response, **options)
File "/opt/ksc_lbaas/.venv/lib/python2.7/site-packages/redis/client.py", line 338, in <lambda>
  'HGETALL': lambda r: r and pairs_to_dict(r) or {},
File "/opt/ksc_lbaas/.venv/lib/python2.7/site-packages/redis/client.py", line 186, in pairs_to_dict
  it = iter(response)
TypeError: 'long' object is not iterable

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Grokzencommented, Nov 14, 2016

@fossilet @huwei88 I will close this one as Fixed in 1.3.1 for now and if you see this reappearing in future releases after 1.3.1 please open one new ticket with the new issue. Thanks for helping out @fossilet 😃

1reaction
huwei88commented, Sep 12, 2016

I’m sorry to make a mistake. After I add some log in redis-py-cluster. I got the real error. This issue should relate to redis-server socket close. Line https://github.com/Grokzen/redis-py-cluster/blob/unstable/rediscluster/pipeline.py#L466 got ConnectionError because client got empty socket data. See https://github.com/andymccurdy/redis-py/blob/master/redis/connection.py#L144. And because I use pipline, then some command can share the same connection. So if the former command got ConnnectionError, the socket and connection seems will be released. Then we get the “AttributeError: ‘NoneType’ object has no attribute ‘readline’” exceptions.

Using lock reduce this issue reproduce times. But can not fix it. May be this is because of server’s performance. And because I used lock, some requests have to be queued which reduced the redis server pressure.

However, I think redis-py-cluster should raise the real exception(ConnectionError) instead of AttributeError.@Grokzen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HGETALL - Redis
Returns all fields and values of the hash stored at key . In the returned value, every field name is followed by its...
Read more >
Redis HGETALL returns each key-value as byte objects ...
redis_return = conn.hgetall('my-hash-key'). What I get in return is a dictionary with all its elements as bytes objects individually, like:
Read more >
Is there any way for hGetAll to return a key-value pair list ...
Hello, Let's say that I save the following key value pairs by using hSet for each key hSet key field value Whenever I...
Read more >
io.vertx.redis.RedisClient.hgetall java code examples - Tabnine
Close the client - when it is fully closed the handler will be called. evalsha. Execute a Lua script server side. Due to...
Read more >
RedisHashCommands (lettuce 4.5.0.Final API)
Parameters: key - the key: field - the field type: key: amount - the increment type: long; Returns: Long integer-reply the value at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found