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

\

:::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} onChange={handleChange} /> <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:.

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 service@support.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

CME Group to Launch Solana and XRP Futures Options

CME Group to Launch Solana and XRP Futures Options

The post CME Group to Launch Solana and XRP Futures Options appeared on BitcoinEthereumNews.com. An announcement was made by CME Group, the largest derivatives exchanger worldwide, revealed that it would introduce options for Solana and XRP futures. It is the latest addition to CME crypto derivatives as institutions and retail investors increase their demand for Solana and XRP. CME Expands Crypto Offerings With Solana and XRP Options Launch According to a press release, the launch is scheduled for October 13, 2025, pending regulatory approval. The new products will allow traders to access options on Solana, Micro Solana, XRP, and Micro XRP futures. Expiries will be offered on business days on a monthly, and quarterly basis to provide more flexibility to market players. CME Group said the contracts are designed to meet demand from institutions, hedge funds, and active retail traders. According to Giovanni Vicioso, the launch reflects high liquidity in Solana and XRP futures. Vicioso is the Global Head of Cryptocurrency Products for the CME Group. He noted that the new contracts will provide additional tools for risk management and exposure strategies. Recently, CME XRP futures registered record open interest amid ETF approval optimism, reinforcing confidence in contract demand. Cumberland, one of the leading liquidity providers, welcomed the development and said it highlights the shift beyond Bitcoin and Ethereum. FalconX, another trading firm, added that rising digital asset treasuries are increasing the need for hedging tools on alternative tokens like Solana and XRP. High Record Trading Volumes Demand Solana and XRP Futures Solana futures and XRP continue to gain popularity since their launch earlier this year. According to CME official records, many have bought and sold more than 540,000 Solana futures contracts since March. A value that amounts to over $22 billion dollars. Solana contracts hit a record 9,000 contracts in August, worth $437 million. Open interest also set a record at 12,500 contracts.…
Share
BitcoinEthereumNews2025/09/18 01:39
Trump’s WLFI Moves To Contain Wallet Breach While Federal Inquiry Looms

Trump’s WLFI Moves To Contain Wallet Breach While Federal Inquiry Looms

World Liberty Financial (WLFI) said it is reallocating funds and confirming user identities after several wallets were compromised ahead of its platform launch. Related Reading: XRP Supply Shock Ahead? ETFs Could Consume It All, Analyst Predicts According to WLFI’s post on X, the company froze the affected addresses in September and has been verifying ownership before moving assets back to users who pass the checks. Wallet Breaches And Response Reports have disclosed that the breaches came from either phishing attacks or exposed seed phrases, not from WLFI’s own platform or smart contracts, the company said. WLFI described the problem as linked to third-party security failures and said only a “small subset” of users were hit — though it did not give exact figures on how many accounts or how much crypto was involved. 1/ Prior to WLFI’s launch, a relatively small subset of user wallets were compromised via phishing attacks or exposed seed phrases. Since then, we’ve tested new smart contract logic to safely reallocate user funds and verified users’ identity via KYC checks. Shortly, users who… — WLFI (@worldlibertyfi) November 19, 2025 On-chain data cited by analyst Emmett Gallic of Arkham shows WLFI executed an emergency action that burned 166.67 million WLFI tokens, a move valued at $22.14 million from a compromised address, and then shifted tokens to a recovery address. That firewall step appears intended to limit further loss while the company sorts ownership questions. World Liberty Fi executed an emergency function burning 166.667M $WLFI ($22.14M) from compromised address, reallocating to a recovery address. Function designed for two scenarios: An investor loses wallet access before vesting OR malicious account acquires WLFI via exploit pic.twitter.com/VSUDWhDPCR — Emmett Gallic (@emmettgallic) November 19, 2025 Regulatory Spotlight Grows The timing of the security disclosure has drawn extra attention. Based on reports, Senators Elizabeth Warren and Jack Reed asked the DOJ and Treasury to review alleged WLFI token sales tied to sanctioned parties. Their letter referenced a watchdog report from Accountable.US that linked transactions to the Lazarus Group — a North Korea-linked actor on sanctions lists — and to an Iranian crypto exchange. It remains unclear whether the wallet compromises are related to the transactions lawmakers flagged. Experts Question On-Chain Findings Security researchers have pushed back on some of the watchdog’s claims. Taylor Moynahan of MetaMask and Nick Bax of Ump.eth said the Accountable.US analysis misread certain on-chain activity. Another day in crypto with wild allegations. Today, it’s that a North Korea-linked address invested in WLFI. I do a some DPRK crypto research myself, so I decided to take a look at their findings. They’re bad and an innocent user is out $100k because of it🧵 pic.twitter.com/yJKEH04nup — Nick Bax.eth (@bax1337) November 18, 2025 Related Reading: With 42% Of XRP Holders Underwater, Analysts Say The Altcoin Could Crash Even Further Bax argued that the report mistakenly connected a wallet tied to an individual known as “Shryder” with DPRK-linked activity, which led to the freezing of roughly $95,000 in WLFI tokens. WLFI has responded by emphasizing user protection and compliance. The company said it prioritized freezing vulnerable wallets and verifying rightful owners before any transfers. It also announced tests of revised smart contract logic meant to reduce the chance of similar breaches in future rollouts. Featured image from Gemini, chart from TradingView
Share
NewsBTC2025/11/21 12:00
Vietnam focuses on digitization; China’s SMEs transform

Vietnam focuses on digitization; China’s SMEs transform

The post Vietnam focuses on digitization; China’s SMEs transform appeared on BitcoinEthereumNews.com. Homepage > News > Business > Vietnam focuses on digitization; China’s SMEs transform Vietnam has reiterated its commitment to digitizing key sectors of its economy with emerging technologies, achieving a string of early successes since the start of the year. Prime Minister Pham Minh Chinh revealed that the next phase of digitization will be characterized by “rapid, robust, and sustainable development,” marked by a special focus on security and safety. Chinh disclosed the government’s stance at the fifth meeting of the Government’s Steering Committee on Science, Technology, and Innovation, urging agencies to be frenzied in their approach. Going forward, the Prime Minister highlights six priority tasks for government agencies to undertake in the pursuit of national digitization. Agencies will focus on completing all ministry- and locality-level databases, with the second task focusing on strengthening institutions spearheading digital transformation. The Southeast Asian nation will place a keen focus on the grassroots development of digital systems, advancing the “Digital Literacy for All” in rural areas. In line with the desire to protect enterprises, the government will allocate priority to data security, with relevant agencies mandated to introduce real-time monitoring tools. The push toward national digitization will be underscored by the measurement of KPIs for evaluation. By the end of November, the Prime Minister expects the restructuring of online public services with full compliance with data-connectivity regulations by the end of the year. The Prime Minister noted that while previous efforts have yielded impressive results, there are still key loopholes to be addressed in Vietnam’s push. He identified the lack of key national databases and an uneven digital infrastructure as the foundation required to support the digitization drive. Chinh added that a lopsided resource allocation system and dire shortages in talent, particularly in artificial intelligence (AI) and blockchain, are headwinds affecting nationwide digitization.…
Share
BitcoinEthereumNews2025/11/21 12:03