Chrome’s Pause Script Execution can be used to freeze a Single Page App (SPA) using a hidden infinite loop deep inside a Redux selector. The root cause of the freeze is a loop that never ends.Chrome’s Pause Script Execution can be used to freeze a Single Page App (SPA) using a hidden infinite loop deep inside a Redux selector. The root cause of the freeze is a loop that never ends.

Breaking Down the Walls: Rescue Your SPA From Complete Freeze

2025/11/13 22:00
5 min read
For feedback or concerns regarding this content, please contact us at crypto.news@mexc.com

\

:::tip The screenshots shown are from the simulated problem section of the article, not the original code issue, due to privacy concerns.

:::

🗂️ Table of Contents

  1. The Setup
  2. The Problem: Page Freeze on Input
  3. Failed Debug Attempts
  4. The Breakthrough: Pause Script Execution
  5. The Root Cause: A Loop That Never Ends
  6. 🧠 Simulating the Freeze (Try It Yourself)
  7. What I Learned
  8. Bonus Thought: Debugging Memory Leaks
  9. Tags

The Setup

This bug appeared in a React + TypeScript + Redux + RxJS project.

\ The form had a single numeric fieldquantity. When updated, it triggered a Redux selector (built using reselect) to recalculate the Total cost state synced text.

\ Everything looked fine on the Buyside.

\ But switching to the Sell side caused something bizarre: the page froze instantly when entering even 1.


The Problem: Page Freeze on Input

When typing in the quantity field:

  • The UI froze completely

  • The browser tab became unresponsive

  • The CPU usage 100% in Chrome Performance Monitor. (Sometimes, the JS heap size also keeps increasing)

This wasn’t a typical “slow” render. It was a complete hang.

\ Chrome eventually showed the “Page Unresponsive” dialog & I had to kill the tab.


Failed Debug Attempts

Common debugging methods didn’t help:

| Attempt | Result | |----|----| | console.log | Never printed anything | | debugger; | Too slow or never triggered | | React DevTools Profiler | Froze with the app | | Chrome Performance Profiler | Couldn’t finish recording | | Removing components | Still froze, even with just the input |

The issue had to be a loop or recursive render running endlessly. But where? :thinking:


The Breakthrough: Pause Script Execution

Then I came to a realization: if the JavaScript heap keeps growing, JavaScript is still running.

So I opened Chrome DevTools → Sources tab and used the hidden gem: \n Pause Script Execution (⏸️)

:::info Unfortunately, I could not see an explanation of this feature even in the official Chrome DevTools docs: https://developer.chrome.com/docs/devtools/javascript/breakpoint

:::

Steps:

  1. Open Chrome DevTools first! You won’t be able to open them during the freeze.

  2. Reproduce the freeze (enter quantity).

  3. When the tab hangs, open DevTools → Sources tab.

  4. Click the ⏸️ Pause icon (top-right).

  5. Chrome freezes JS execution at that exact line.

  6. Scroll down on the right panel & check the Call Stack panel to trace which functions are currently executing.

  7. Scroll through the parent calls to reveal how the function chain started. You can even click on the parent calls to see their invoked line!


The Root Cause: A Loop That Never Ends

The paused stack revealed a chain of 8+ functions, starting from the onChange handler and ending inside a utility function used by a Redux Reselect selector.

\ Here’s the culprit:

let a = 0; const size = props.size; // expected number, got string while (a < size) { // do something }

Turns out props.size came indirectly from the input value: a string like "5".

\ Due to JS coercion quirks, the loop comparison failed to exit under certain conditions, causing an infinite loop and freezing the entire thread.

\ Fixing it was as simple as converting the value to a number before use:

const size = Number(props.size);

Instantly, the page freeze disappeared :tada:.


🧠 Simulating the Freeze (Try It Yourself)

You can recreate this exact bug and try the debugging trick yourself by going to this codesandbox link OR running the below code in a new Create React App, but save your work first because this will hang your browser tab 😅

import { useState } from "react"; export default function App() { const [quantity, setQuantity] = useState(""); const handleChange = (e) => { const value = e.target.value; setQuantity(value); const end = Date.now() + 145000; let a = 0; // ❌ Intentional infinite loop while (Date.now() < end) { // Busy-wait a++; } console.log("Done!"); // never reached }; return ( <div style={{ padding: 20 }}> <h2>🧊 Simulate a Page Freeze</h2> <input type="text" placeholder="Enter quantity" value={quantity} /> <p>Type any number and watch Chrome suffer.</p> </div> ); }

Steps to Reproduce

  1. Open this code in the above codesandbox or locally.

  2. Type any number in the input.

  3. Watch the tab freeze solid.

  4. Open Chrome DevTools → Sources tab → ⏸️ Pause script execution.

  5. Observe the infinite loop inside handleChange in the call stack.


What I Learned

  • When nothing works: pause script execution is the silver bullet.
  • Infinite loops can hide inside selectors, reducers, or utility files far from the UI.
  • Always sanitize and type-check user input before computations.
  • while loops are sharp tools: one wrong condition and your app becomes a CPU toaster :zippermouthface:.

Bonus Thought: Debugging Memory Leaks

This same technique could help track slow memory leaks→ cases where the JS heap increases gradually.

\ Pausing script execution during idle time might reveal which background processes or subscriptions are still running unnecessarily.

\ But that’s an experiment for another article :wink:.

Market Opportunity
Sperax Logo
Sperax Price(SPA)
$0.003332
$0.003332$0.003332
-2.68%
USD
Sperax (SPA) Live Price Chart
Disclaimer: The articles reposted on this site are sourced from public platforms and are provided for informational purposes only. They do not necessarily reflect the views of MEXC. All rights remain with the original authors. If you believe any content infringes on third-party rights, please contact crypto.news@mexc.com for removal. MEXC makes no guarantees regarding the accuracy, completeness, or timeliness of the content and is not responsible for any actions taken based on the information provided. The content does not constitute financial, legal, or other professional advice, nor should it be considered a recommendation or endorsement by MEXC.

You May Also Like

XAG/USD struggles near $75.50 on firm hopes of Fed’s extended pause

XAG/USD struggles near $75.50 on firm hopes of Fed’s extended pause

The post XAG/USD struggles near $75.50 on firm hopes of Fed’s extended pause appeared on BitcoinEthereumNews.com. Silver price (XAG/USD) struggles to gain ground
Share
BitcoinEthereumNews2026/03/19 14:04
WLFI Price Drops 4% Despite New Governance Proposal

WLFI Price Drops 4% Despite New Governance Proposal

The post WLFI Price Drops 4% Despite New Governance Proposal appeared on BitcoinEthereumNews.com. Key Highlights World Liberty Financial (WLFI) price dropped by
Share
BitcoinEthereumNews2026/03/19 14:19
SEC greenlights new generic standards to expedite crypto ETP listings

SEC greenlights new generic standards to expedite crypto ETP listings

The post SEC greenlights new generic standards to expedite crypto ETP listings appeared on BitcoinEthereumNews.com. The U.S. Securities and Exchange Commission (SEC) has approved a new set of generic listing standards for commodity-based trust shares on Nasdaq, Cboe, and the New York Stock Exchange. The move is expected to streamline the approval process for exchange-traded products (ETPs) tied to digital assets, according to Fox Business reporter Eleanor Terret. However, she added that the Generic Listing Standards don’t open up every type of crypto ETP because threshold requirements remain in place, meaning not all products will immediately qualify. To add context, she quoted Tushar Jain of Multicoin Capital, who noted that the standards don’t apply to every type of crypto ETP and that threshold requirements remain. He expects the SEC will iterate further on these standards. The order, issued on Sept. 17, grants accelerated approval of proposed rule changes filed by the exchanges. By adopting the standards, the SEC aims to shorten the time it takes to bring new commodity-based ETPs to market, potentially clearing a path for broader crypto investment products. The regulator has been delaying the decision on several altcoin ETFs, most of which are set to reach their final deadlines in October. The move was rumored to be the SEC’s way of expediting approvals for crypto ETFs. The approval follows years of back-and-forth between the SEC and exchanges over how to handle crypto-based products, with past applications facing lengthy reviews. The new process is expected to reduce delays and provide more clarity for issuers, though the SEC signaled it may revisit and refine the standards as the market evolves. While the decision marks progress, experts emphasized that the so-called “floodgates” for crypto ETPs are not yet fully open. Future SEC actions will determine how broadly these standards can be applied across different digital asset products. Source: https://cryptoslate.com/sec-greenlights-new-generic-standards-to-expedite-crypto-etp-listings/
Share
BitcoinEthereumNews2025/09/18 08:43