-
Notifications
You must be signed in to change notification settings - Fork 469
Fix UnicodeDecodeError in aioredis integration #3089
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c0e13e8
Fix UnicodeDecodeError in aioredis integration
jalaziz 6785142
remove unnecessary errors arg to decode
jalaziz 232ce84
add tests
jalaziz bf3d1cc
Use ensure_text instead of stringify in some situations
jalaziz b556d80
Merge branch 'master' into aioredis-decoding
brettlangdon 64cd8a3
PR feedback
jalaziz cf2856d
Release notes
jalaziz bd88475
formatting
jalaziz e92b007
revert list extend change
jalaziz ca03b77
fix spelling
jalaziz dc521bc
Merge branch 'master' into aioredis-decoding
jalaziz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
releasenotes/notes/fix-aioredis-unicodedecodeerror-b861b199e8757950.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| fixes: | ||
| - | | ||
| Escape non-Unicode bytes when decoding aioredis args. This fixes a | ||
| ``UnicodeDecodeError`` that can be thrown from the aioredis integration | ||
| when interacting with binary-encoded data, as is done in channels-redis. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
tests/snapshots/tests.contrib.aioredis.test_aioredis.test_decoding_non_utf8_args.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| [[ | ||
| { | ||
| "name": "redis.command", | ||
| "service": "redis", | ||
| "resource": "SET \\x80foo \\x80abc", | ||
| "trace_id": 0, | ||
| "span_id": 1, | ||
| "parent_id": 0, | ||
| "type": "redis", | ||
| "meta": { | ||
| "out.host": "127.0.0.1", | ||
| "redis.raw_command": "SET \\x80foo \\x80abc", | ||
| "runtime-id": "af49d807abff41089eed43f05d099627" | ||
| }, | ||
| "metrics": { | ||
| "_dd.agent_psr": 1.0, | ||
| "_dd.measured": 1, | ||
| "_dd.top_level": 1, | ||
| "_dd.tracer_kr": 1.0, | ||
| "_sampling_priority_v1": 1, | ||
| "out.port": 6379, | ||
| "out.redis_db": 0, | ||
| "redis.args_length": 3, | ||
| "system.pid": 36293 | ||
| }, | ||
| "duration": 6351000, | ||
| "start": 1640819680842990000 | ||
| }], | ||
| [ | ||
| { | ||
| "name": "redis.command", | ||
| "service": "redis", | ||
| "resource": "GET \\x80foo", | ||
| "trace_id": 1, | ||
| "span_id": 1, | ||
| "parent_id": 0, | ||
| "type": "redis", | ||
| "meta": { | ||
| "out.host": "127.0.0.1", | ||
| "redis.raw_command": "GET \\x80foo", | ||
| "runtime-id": "af49d807abff41089eed43f05d099627" | ||
| }, | ||
| "metrics": { | ||
| "_dd.agent_psr": 1.0, | ||
| "_dd.measured": 1, | ||
| "_dd.top_level": 1, | ||
| "_dd.tracer_kr": 1.0, | ||
| "_sampling_priority_v1": 1, | ||
| "out.port": 6379, | ||
| "out.redis_db": 0, | ||
| "redis.args_length": 2, | ||
| "system.pid": 36293 | ||
| }, | ||
| "duration": 1959000, | ||
| "start": 1640819680849456000 | ||
| }]] |
28 changes: 28 additions & 0 deletions
28
.../snapshots/tests.contrib.aioredis.test_aioredis.test_decoding_non_utf8_pipeline_args.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| [[ | ||
| { | ||
| "name": "redis.command", | ||
| "service": "redis", | ||
| "resource": "SET \\x80blah boo\nSET foo \\x80abc\nGET \\x80blah\nGET foo", | ||
| "trace_id": 0, | ||
| "span_id": 1, | ||
| "parent_id": 0, | ||
| "type": "redis", | ||
| "meta": { | ||
| "out.host": "127.0.0.1", | ||
| "redis.raw_command": "SET \\x80blah boo\nSET foo \\x80abc\nGET \\x80blah\nGET foo", | ||
| "runtime-id": "e6362b13a7394c2490fc39fa29c0e4af" | ||
| }, | ||
| "metrics": { | ||
| "_dd.agent_psr": 1.0, | ||
| "_dd.measured": 1, | ||
| "_dd.top_level": 1, | ||
| "_dd.tracer_kr": 1.0, | ||
| "_sampling_priority_v1": 1, | ||
| "out.port": 6379, | ||
| "out.redis_db": 0, | ||
| "redis.pipeline_length": 4, | ||
| "system.pid": 60727 | ||
| }, | ||
| "duration": 922000, | ||
| "start": 1640911687480019000 | ||
| }]] |
28 changes: 28 additions & 0 deletions
28
...apshots/tests.contrib.aioredis.test_aioredis.test_decoding_non_utf8_pipeline_args_13.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| [[ | ||
| { | ||
| "name": "redis.command", | ||
| "service": "redis", | ||
| "resource": "SET \\x80blah boo\nSET foo \\x80abc\nGET \\x80blah\nGET foo", | ||
| "trace_id": 0, | ||
| "span_id": 1, | ||
| "parent_id": 0, | ||
| "type": "redis", | ||
| "meta": { | ||
| "out.host": "127.0.0.1", | ||
| "redis.raw_command": "SET \\x80blah boo\nSET foo \\x80abc\nGET \\x80blah\nGET foo", | ||
| "runtime-id": "2c1fc87edd3b44ea8e46fe3854500d3c" | ||
| }, | ||
| "metrics": { | ||
| "_dd.agent_psr": 1.0, | ||
| "_dd.measured": 1, | ||
| "_dd.top_level": 1, | ||
| "_dd.tracer_kr": 1.0, | ||
| "_sampling_priority_v1": 1, | ||
| "out.port": 6379, | ||
| "out.redis_db": 0, | ||
| "redis.pipeline_length": 4, | ||
| "system.pid": 60927 | ||
| }, | ||
| "duration": 982000, | ||
| "start": 1640911730323059000 | ||
| }]] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.