Skip to content

Exception when the Django cache integration checks for cache hit #5027

@ddabble

Description

@ddabble

How do you use Sentry?

Sentry Saas (sentry.io)

Version

2.42.0

Steps to Reproduce

  1. Set up Django's cache framework using Redis
  2. Call sentry_sdk.init() with:
    integrations=[
        DjangoIntegration(cache_spans=True),
        ...
    ]
  3. Cache an instance of NDFrame (we're specifically creating a GeoDataFrame) using cache.set()
  4. Retrieve the instance using cache.get()

Expected Result

No exception should be logged using Sentry's internal logger.

Actual Result

This check triggers NDFrame.__bool__(), which raises a ValueError, causing Sentry to log an internal exception.

Fix suggestion

It looks like the previously mentioned check is for whether there was a cache hit or not, and so I'm assuming this bug could be fixed by simply changing the check to if value is not None:, as None is the default value that will be returned by cache.get() on a cache miss.

Metadata

Metadata

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions