Skip to content

Commit 083962f

Browse files
authored
fix(aioredis): handle all BaseException, not Exception in _finish_span (backport #4193) (#4196)
This is an automatic backport of pull request #4193 done by [Mergify](https://mergify.com). --- <details> <summary>Mergify commands and options</summary> <br /> More conditions and actions can be found in the [documentation](https://docs.mergify.com/). You can also trigger Mergify actions by commenting on this pull request: - `@Mergifyio refresh` will re-evaluate the rules - `@Mergifyio rebase` will rebase this PR on its base branch - `@Mergifyio update` will merge the base branch into this PR - `@Mergifyio backport <destination>` will backport this PR on `<destination>` branch Additionally, on Mergify [dashboard](https://dashboard.mergify.com/) you can: - look at your merge queues - generate the Mergify configuration with the config editor. Finally, you can contact us on https://mergify.com </details>
1 parent dd2b503 commit 083962f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ddtrace/contrib/aioredis/patch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,12 @@ def traced_13_execute_command(func, instance, args, kwargs):
140140
def _finish_span(future):
141141
try:
142142
# Accessing the result will raise an exception if:
143-
# - The future was cancelled
143+
# - The future was cancelled (CancelledError)
144144
# - There was an error executing the future (`future.exception()`)
145145
# - The future is in an invalid state
146146
future.result()
147-
except Exception:
147+
# CancelledError exceptions extend from BaseException as of Python 3.8, instead of usual Exception
148+
except BaseException:
148149
span.set_exc_info(*sys.exc_info())
149150
finally:
150151
span.finish()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
fixes:
3+
- |
4+
aioredis: added exception handling for `CancelledError` in the aioredis integration.

0 commit comments

Comments
 (0)