Back to Blog Home

Debugging weird stack traces with Session Replay

Sarah Guthals image

Sarah Guthals -

Debugging weird stack traces with Session Replay

Imagine this: Your website is getting a lot of traffic and you have some kind of metrics, logging, or performance monitoring setup (maybe even Sentry). You’re alerted to something… odd.

You open up your error and see that a request was interrupted by another request. Uh oh. This sounds like a user was rage-clicking , clicking like crazy making duplicate requests. You weren’t expecting that! This is an atypical behavior (and a very uncommon error) for the page they’re on, but you figure the stack trace should be able to at least point you to the code that is causing the issue.

And, darn it, the stack trace doesn’t actually give you a lot of information. Through the breadcrumbs, you can see that the user was clicking around the page on various buttons and adjusting settings when all of a sudden the error is triggered. This is a classic example of a non-illustrative stack trace, and where Session Replay can come in handy.

Syntax.fm “cannot pause without first playing”

Back in October of 2023, Wes Bos of Syntax.fm was alerted to an error: image3

Before we jump into how he figured out what this error was and how he fixed it, let me give you a little background on audio on websites. Most browsers will prevent audio from being played unless it’s associated with a user click (you know, avoiding those MySpace days). Syntax.fm has over 700 episodes at the time of this blog post, so the player doesn’t load any audio until the user clicks the Play button.

So when Wes and the team got the JavaScript issue alert Error: AbortError: The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22 they incorrectly assumed the issue was that the request to play audio through the browser wasn’t associated with a click and so the browser was blocking the audio from playing.

But, before jumping straight into the code, Wes thought he’d check Sentry. Browsing the issue on Sentry wasn’t as helpful as he thought it would be, unfortunately. In particular, the stack trace was…practically empty:

image1

Luckily, he’s got Session Replay set up, so his debugging didn’t end at the stack trace.

Session Replay helps debug non-illustrative stack traces

But, just to be sure, Wes decided to load up the Replay for this particular issue since the stack trace was fairly non-illustrative of what happened.

So what we see in this Replay is:


Breadcrumb Timestamp: 00:00
User is scrolling the Syntax.fm homepage

Breadcrumb Timestamp: 00:13
User clicked into Episode 680 User browses the episode page, you can see in the video that they are seemingly reading through the show notes

Breadcrumb Timestamp: 00:27
User clicks on an item in the show notes on a specific timestamp You can see the audio player jump to the timestamp that they clicked on

Breadcrumb Timestamp: 00:31
The user clicks the pause button The Error is triggered

Breadcrumb Timestamp: 00:33 - 00:53
The user tries…everything they can think of to get the audio to play. They:

  • Scrub the range on the audio player
  • Scrub the range on the audio player again
  • Clicks around, likely doing some rage clicking
  • Clicks on the mute button on the audio player
  • Adjusts the volume on the audio player

At the 00:27 timestamp, you can see in the video above that the audio player jumps to the timestamp that the user clicked on, but there is no audio loaded. Wes knew this immediately because when there is audio loaded in the player you get a grayed-out portion of the audio timeline to indicate how much of the audio has been loaded in, like this: image2

This is where Wes, with his MySpace memories in tow, realized that in an effort to avoid auto-play altogether, they might have restricted audio pre-loading too much.: The audio was never loaded because the Play button was never clicked

The show notes link to the timestamp triggered all the right things in the player and the browser:

  • The browser wasn’t preventing the audio from playing, since it was the result of a click
  • The player was ready to start playing and started progressing through the timeline

But the audio itself was never loaded to the client because the play button was never clicked.

Without being able to watch what was happening in the replay, Wes and the team would have gone down a rabbit hole trying to fix an issue that was never an issue to begin with.

Resolving the audio playback issues - a quick fix

At this point, you might be wondering like I was: how did Wes decide to resolve this issue once they realized the true culprit?

What’s more, while making this fix, Wes visited the docs referenced in the original error message (https://goo.gl/LdLk22) and read: As the video is not loaded due to preload=“none”, video playback doesn’t necessarily start immediately after video.play() is executed.

In a follow-up post, Wes described the fix (which you can see on GitHub). Basically, when a timestamp is clicked on, they had to:

  • Load the audio file
  • Wait for the audio element to resolve play (await audio.play())
  • Adjust the actual timestamp of the player

Let Session Replay help you find your nuanced bugs

If you haven’t already, give Session Replay a try. We are constantly releasing updates to improve the effectiveness of these insights. For example, if you’re a Next.js developer you’ve likely encountered Hydration Errors; we’ve now incorporated support for identifying and resolving them into Session Replay.

And if you have any additional questions or feedback, don’t hesitate to reach out on GitHub, Discord, or Twitter.

FAQs

A non-illustrative stack trace refers to a situation where the stack trace generated by an error or issue in an application does not provide sufficient information to diagnose the root cause of the problem. It may lack specific details about the code or actions leading up to the error, making it challenging for developers to identify and resolve the issue effectively.

When you have an error but there is no useful information in the stack trace (or there isn’t a stack trace accessible at all), this will prolong the time required to identify and resolve the underlying issue. Without clear insights into the sequence of events leading to the error, you may struggle to reproduce the issue, leading to delays in resolving critical issues and potential frustration for users.

Session Replay is a product of Sentry that captures video-like reproductions of user sessions within an application, allowing developers to visualize and analyze user interactions. In situations involving non-illustrative stack traces, Session Replay can provide valuable context by showing developers exactly what actions users were taking before encountering the error. This insight can help developers better understand the user’s journey, identify potential triggers for the error, and ultimately resolve the issue more efficiently.

In this example, in particular, Wes used Session Replay to replay the user session associated with an error. He saw that the user scrolled the Syntax.fm homepage, clicked into Episode 680, browsed the episode page, clicked on an item in the show notes to a specific timestamp, and then clicked the pause button, which triggered the error. The user then attempted various actions to get the audio to play, including scrubbing the audio timeline, clicking around, and adjusting volume settings.

Wes realized that the audio was never loaded because the Play button was never clicked. Despite the user’s actions triggering the audio player to progress through the timeline, the audio itself was not loaded to the client because the Play button was not activated.

Session Replay provides clear visual evidence of what is happening in problematic user sessions. Without Session Replay, you likely lack context and might incorrectly assume the cause of the issue and waste time trying to fix a problem that doesn’t exist.

Session Replay assists in finding nuanced bugs by providing developers with a visual replay of user sessions, allowing them to observe user interactions and identify potential issues. In Wes’s case, Session Replay helped uncover the true cause of the audio playback issue by showing the sequence of user actions leading up to the error.

Session Replay is always being improved, from stack specific features (e.g. hydration error diffs) to expanding to mobile with mobile specific features (e.g. anr). You can keep up to date with all of Session Replay’s updates on our changelog.

Share

Share on Twitter
Share on Facebook
Share on HackerNews
Share on LinkedIn

Published

Sentry Sign Up CTA

Code breaks, fix it faster

Sign up for Sentry and monitor your application in minutes.

Try Sentry Free

Topics

Error Monitoring

The best way to debug slow web pages

Listen to the Syntax Podcast

Of course we sponsor a developer podcast. Check it out on your favorite listening platform.

Listen To Syntax
    TwitterGitHubDribbbleLinkedinDiscord
© 2024 • Sentry is a registered Trademark
of Functional Software, Inc.