Potential bug in Raygun client? 22,549 reports from a single user in 3 hours (unobserved task exception)

xleon

Posted on
Jan 30 2019

Today we reached our plan limits because of this report:

Class name  
System.AggregateException

Message 
A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.

StackTrace:
Message: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
There is currently no stacktrace data available for this error.

Total instances
22,549

Spanning
2 hours and 57 mins

1 device affected:
samsung SM-G950F

A bit of research.

1) This exception seams to happen when unobserved tasks throw after being collected by GC.

2) This should never happen when a program is subscribed to the event TaskScheduler.UnobservedTaskException, which Raygun client is actually doing on Attach:

public static void Attach(string apiKey)
    {
      RaygunClient.Detach();
      if (RaygunClient._client == null)
        RaygunClient._client = new RaygunClient(apiKey);
      AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(RaygunClient.CurrentDomain_UnhandledException);
      TaskScheduler.UnobservedTaskException += new EventHandler<UnobservedTaskExceptionEventArgs>(RaygunClient.TaskScheduler_UnobservedTaskException);
      AndroidEnvironment.UnhandledExceptionRaiser += new EventHandler<RaiseThrowableEventArgs>(RaygunClient.AndroidEnvironment_UnhandledExceptionRaiser);
    }

And this is the handler:

private static void TaskScheduler_UnobservedTaskException(
      object sender,
      UnobservedTaskExceptionEventArgs e)
    {
      if (e.Exception == null)
        return;

      RaygunClient._client.Send((Exception) e.Exception);
    }

However that handler may be missing e.SetObserved() according to this https://stackoverflow.com/questions/7883052/a-tasks-exceptions-were-not-observed-either-by-waiting-on-the-task-or-accessi/7883087#7883087

3) Apart from the unobserved task issue above, it looks like the same report has been sent thousands of times. Could it be an issue in the sending queue logic?

4) it´s the first time this happens to us

5) as you can see above, it happened only from a single device


Deleted User

Raygun

Posted on
Jan 31 2019

Hi xleon,

We are investigating into this issue and will look to put out a fix very soon. I have messaged you privately regarding your plans usage. Thank you for bringing this to our attention, we hope to have this resolved shortly.

Regards, Mitchell.


Reply