Closed Bug 1597558 Opened 5 years ago Closed 4 years ago

Raygun.io middleware can't report errors on Python 3 branch

Categories

(Webtools Graveyard :: Pontoon, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jotes, Assigned: jotes)

Details

Attachments

(1 file)

Integration with Raygun.io doesn't work on Python 3 because the middleware throws an exception:

AttributeError at /
'bytes' object has no attribute '__traceback__'

The exception is caused by RaygunExceptionMiddleware because it sends bytes instead of an exception object to the parent class.

Also, I noticed that Raygun4py has separate implementations of the library Python 2 and Python 3 and they slightly differ:

diff -u  python3/raygun4py/raygunprovider.py python2/raygun4py/raygunprovider.py
--- python3/raygun4py/raygunprovider.py	2019-11-19 00:49:20.289637395 +0100
+++ python2/raygun4py/raygunprovider.py	2019-11-19 00:49:20.289637395 +0100
@@ -4,9 +4,12 @@
(...)
     def set_user(self, user):
@@ -89,10 +93,16 @@
         exc_type, exc_value, exc_traceback = exc_info
 
         if exception is not None:
-            errorMessage = raygunmsgs.RaygunErrorMessage(type(exception), exception, exception.__traceback__, options)
+            errorMessage = raygunmsgs.RaygunErrorMessage(type(exception), exception, exc_traceback, options)
         else:
             errorMessage = raygunmsgs.RaygunErrorMessage(exc_type, exc_value, exc_traceback, options)
 
+        # Prevent circular reference for GC - https://docs.python.org/2/library/sys.html#sys.exc_info
+        try:
+            del exc_type, exc_value, exc_traceback
+        except Exception as e:
+            raise
+
         tags, custom_data, http_request, extra_environment_data = self._parse_args(kwargs)
         message = self._create_message(errorMessage, tags, custom_data, http_request, extra_environment_data)
         message = self._transform_message(message)

That's probably the reason why the problem wasn't noticed sooner.

Assignee: nobody → poke
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: