Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip slowlogs if there is an error #9147

Merged
merged 3 commits into from
Apr 14, 2021
Merged

Conversation

hithwen
Copy link
Contributor

@hithwen hithwen commented Apr 13, 2021

Mitigates #8716
Caused by redis/redis-py#1475

@hithwen hithwen requested a review from a team as a code owner April 13, 2021 10:00
@ghost ghost added the integration/redisdb label Apr 13, 2021
@@ -449,7 +449,8 @@ def _check_slowlog(self):

# Get all slowlog entries

slowlogs = conn.slowlog_get(max_slow_entries)
# https://github.com/andymccurdy/redis-py/issues/1238
slowlogs = conn.slowlog_get(max_slow_entries, decode_responses=False)
Copy link
Contributor

@ChristineTChen ChristineTChen Apr 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@hithwen hithwen Apr 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes, indeed, this methods uses the connection options, and 'decode_responses' is false by default https://github.com/andymccurdy/redis-py/blob/master/redis/client.py#L744.
It would also not help in any case since both options would produce the same result

>>> ' '.join([1, 2, 3])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: sequence item 0: expected str instance, int found

>>> b' '.join([1, 2, 3])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: sequence item 0: expected a bytes-like object, int found

In the linked issue the error is str found while here is int found

@hithwen hithwen closed this Apr 13, 2021
@hithwen hithwen reopened this Apr 13, 2021
@hithwen hithwen changed the title Do not decode responses on slowlog_get Skip slowlogs if there is an error Apr 13, 2021
@hithwen hithwen merged commit 4868791 into master Apr 14, 2021
@hithwen hithwen deleted the js/AI-1506-redis-stacktrace branch April 14, 2021 08:55
@hithwen hithwen mentioned this pull request May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants