-
Notifications
You must be signed in to change notification settings - Fork 555
Labels
BugComponent: SDK CoreDealing with the core of the SDKDealing with the core of the SDKIntegration: DedupePythonSDKSDK
Description
When using logging.exception
sentry does not release exception instance, which results in the memory leak. Exception could be pretty heavy, so depending on the app, it could even cause an OOM.
import logging
import weakref
import time
import sentry_sdk
weak_exception = None
class CustomException(Exception):
pass
def callback(ref):
print("Exception was garbage collected!")
sentry_sdk.init(<init params>)
try:
raise CustomException('Custom Exception')
except Exception as e:
logging.exception("Exception logging")
weak_exception = weakref.ref(e, callback)
sentry_sdk.flush()
while True:
time.sleep(1)
print(weak_exception())
In the code above, with sentry OFF, exception is garbage collected almost immediately, with sentry ON it stays around even after sentry is forced to flush all the events.
It seems like pretty severe issue, so curious if there is any workaround.
Version 2.5
nkhitrov, ramonklu and Sombrero1
Metadata
Metadata
Assignees
Labels
BugComponent: SDK CoreDealing with the core of the SDKDealing with the core of the SDKIntegration: DedupePythonSDKSDK
Type
Projects
Status
No status