What is Subkeying?

Today I’m going to review Subkeying, and how it can be useful for grouping sets of crash reports.

Subkeying is an easy way of grouping a set of crash reports by something other than the top of the stack trace, as they would be grouped by default. It can be extremely useful when the default grouping contains a large number of crash reports with multiple code paths leading to a common crashing function.

In this case, a developer is likely more concerned about function calls lower in the stack trace, which were called prior to the crashing function. Subkeying allows developers to group program crashes at some arbitrary level in the stack trace.

Here’s an Example!

The classes Widget, Gizmo and Doohickey all implement the IPrintable interface. To fulfill the interface contract each class must implement the Print() method which returns void and takes no parameters.

Each implementation of Print() calls the System.Drawing.Image.Save() method in a way that causes a program crash. Each bug is a separate code path and in this instance, all paths cause a crash in the same method. BugSplat groups crashes under the line of code that triggered an unhandled exception.

The line in the call stack where the program crashed is also known as the “stack key”.

In this example our stack key is not terribly useful because the crash took place within System.Drawing.Image.Save(). Save() is a system method that can’t be changed and the actual bug was created earlier in the call stack. Since the Widget, Gizmo and Doohickey implementations of Print() call Save() differently it may not make sense to group all of the crashes under Save(). Developers might want to group the crashes by the Widget, Gizmo and Doohickey implementations.

User Story!

As a developer I want to group crashes by subkey so that I can more easily sort and manage my program’s crashes. Sorting program crashes brings visibility to problems customers are running into most often and allows developers to prioritize their fixes accordingly! The following crashes are from the AcmeSoftware sample application.


Fig. 1 Sample crashes on the All page.

For applications that generate large crash volumes it may not be feasible to look at each crash individually. The Summary page provides an overview of the crashes. Notice the sample crashes are grouped together under a common stack key on the Summary page.


Fig. 2 The crashes grouped on the Summary page

In this case the stack key is System.Drawing.Image.Save(). Clicking on the stack key loads the keycrash page. The keycrash page lists all of the crashes that share the System.Drawing.Image.Save() stack key.


Fig. 3 The /keycrash page

Selecting the callstack explorer link provides an in depth look at each of the code paths that caused a program crash. The number next to each node represents how many crashes traveled through that line of code. Notice in fig. 4 that four crashes were caused by Doohickey.Print(), one crash was caused by Widget.Print() and one crash was caused by Gizmo.Print().


Fig. 4 The Call Stack Explorer

The Call Stack Explorer helps you prioritize code paths, so that you can always address the most important first. In this case it makes sense to separate the crashes by Widget, Doohickey and Gizmo. Since Doohickey caused 4 crashes it may also make sense to address the crash in Doohickey.Print() before Widget.Print() or Gizmo.Print(). Clicking the Doohickey.Print() link in the tree loads the groupkey page.


Fig. 5 The /groupkey page

In this case, clicking the Group Reports button creates subkey at the 4th level of the callstack. Browsing back to the Summary page will yield the following:


Fig. 6 The Summary page after subkeying

That’s it! Navigating to any of those subkeys will display a more refined list of crashes. It is now possible to create 3 separate stack key defects,. Before subkeying all of the crashes would have been listed under a single stack key. Creating stack key defects is a better solution than addressing every crash individually. Note that the “stack key defect” link only shows up if you have configured defect tracking integration.


Fig. 7 Create a Stack Key defect

It’s also possible to ungroup your subkeys. To do this, navigate to the callstack explorer page and select the top-most stack key. On the next page click the Group Reports button to regroup the reports at the default stack key.

I hope this tutorial was useful and informative! Thank you for choosing BugSplat, and happy hunting!




Comments are closed.