Opened 6 months ago
Last modified 6 months ago
#35496 closed Bug
ASGI Connection Leakage during Exception Logging — at Initial Version
Reported by: | mietma | Owned by: | |
---|---|---|---|
Component: | Error reporting | Version: | 4.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
I am having trouble with Django ASGI leaving idle connections if exceptions are thrown. I narrowed it down to the logging of the exceptions.
The 'ExceptionReporter' opens new connections during the 'get_traceback_text()' method, which are then not closed.
I made a workaround by implementing a custom ExceptionReporter which closes connections afterwards.
class CustomExceptionReporter(ExceptionReporter):
def get_traceback_text(self):
res = super().get_traceback_text()
close_old_connections()
return res
Is my approach correct or am I destroying something else?
Best regards,
Matthias