Unhandled AttributeError if reservoir is None
Open
- Dominant language
- Python
- Stars
- 338
- Forks
- 147
- PR merge metrics
- No merged PRs in 30d
Description
Calling `reservoir.borrow_or_take(now, rule.can_borrow)` leads to an `AttributeError` if `reservoir is None`. See screenshot (sentry) for details.

Looks like a race condition caused by merging rules. We saw this in production, but only once.
https://github.com/aws/aws-xray-sdk-python/blob/2d12c83383ea42e955ad530a7c18832c7881fb32/aws_xray_sdk/core/sampling/rule_cache.py#L47-L50
https://github.com/aws/aws-xray-sdk-python/blob/2d12c83383ea42e955ad530a7c18832c7881fb32/aws_xray_sdk/core/sampling/sampling_rule.py#L71-L80
Contributor guide
Assessment
This issue has not been assessed yet.