getsentry / sentry-python

The official Python SDK for Sentry.io
https://sentry.io/for/python/
MIT License
1.91k stars 504 forks source link

Sentry SDK erroring every request #3539

Closed JoshFerge closed 1 month ago

JoshFerge commented 1 month ago

How do you use Sentry?

Sentry Saas (sentry.io)

Version

2.12.0

Steps to Reproduce

The sentry SDK is erroring what seems like nearly every request on Sentry's internal hybrid cloud RPC pods. It started on Aug 14 ~11 AM PST and continues to today. This is causing 10s millions of logs to be sent, and has possibly large effects on the latency of hybrid cloud request calls. I don't see any commits lining up when this started occuring, but seems like a somewhat simple fix SDK side, to at least not error.

https://console.cloud.google.com/logs/query;query=resource.type%3D%22k8s_container%22%0Alabels.name%3D~%22sentry%22%0A-labels.name%3D%22sentry.access.api%22%0AjsonPayload.name%3D%22sentry_sdk.errors%22%0Alabels.name%3D%22sentry_sdk.errors%22%0A%22WSGIRequest%22;summaryFields=:true:32:beginning;lfeCustomFields=labels%252F%2522k8s-pod%252Fservice%2522;cursorTimestamp=2024-08-14T18:06:32.262136870Z;aroundTime=2024-08-14T17:50:16.689Z;duration=PT1H?project=internal-sentry&rapt=AEjHL4OyxsqTpJDNXDvnY7TfRndLT31Fr3F93ohLYI6x7gCF5X8q2Kk4F32STWs6HqL2snyUk4ygA_8FXDGBceGeTGRoX0JOBgBan2p8yAJUC0q6YUwzj8A

Traceback (most recent call last): File "/.venv/lib/python3.11/site-packages/sentry_sdk/integrations/django/init.py", line 572, in parsed_body return self.request.data ^^^^^^^^^^^^^^^^^ AttributeError: 'WSGIRequest' object has no attribute 'data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/.venv/lib/python3.11/site-packages/sentry_sdk/integrations/django/init.py", line 503, in wsgi_request_event_processor DjangoRequestExtractor(request).extract_into_event(event) File "/.venv/lib/python3.11/site-packages/sentry_sdk/integrations/_wsgi_common.py", line 97, in extract_into_event parsed_body = self.parsed_body() ^^^^^^^^^^^^^^^^^^ File "/.venv/lib/python3.11/site-packages/sentry_sdk/integrations/django/init.py", line 574, in parsed_body return RequestExtractor.parsed_body(self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/.venv/lib/python3.11/site-packages/sentry_sdk/integrations/_wsgi_common.py", line 143, in parsed_body return self.json() ^^^^^^^^^^^ File "/.venv/lib/python3.11/site-packages/sentry_sdk/integrations/_wsgi_common.py", line 155, in json raw_data = self.raw_data() ^^^^^^^^^^^^^^^ File "/.venv/lib/python3.11/site-packages/sentry_sdk/integrations/django/init.py", line 555, in raw_data return self.request.body ^^^^^^^^^^^^^^^^^ File "/.venv/lib/python3.11/site-packages/django/http/request.py", line 328, in body raise RawPostDataException( django.http.request.RawPostDataException: You cannot access body after reading from request's data stream

Expected Result

sentry SDK should not error in control silos

Actual Result

these errors

sentrivana commented 1 month ago

Probably related: https://github.com/getsentry/sentry-python/issues/3045