Dev.to WebDev 🛠 Dev 👁 0 📖 2 min read

Postmortem: A MutationObserver Feedback Loop Froze a Production Website

A production website started freezing across multiple devices, with users reporting browser hangs and Chrome's "Not Responding" message. What initially looked like a device-specific performance issue turned out to be a

A production website started freezing across multiple devices, with users reporting browser hangs and Chrome's "Not Responding" message.

What initially looked like a device-specific performance issue turned out to be a JavaScript DOM observation problem.

This is the story of how we investigated it, identified the root cause, and deployed a fix.

  1. The Incident

On November 20, 2026, approximately 45 users reported that the website was freezing during normal use.

Reported symptoms included:

  • The page becoming unresponsive.
  • Scrolling and other interactions stopping.
  • Chrome displaying a "Not Responding" message.
  • The issue appearing on multiple devices, including mobile devices.

The reports suggested that this was not simply an isolated device problem.

  1. Root Cause: MutationObserver Feedback Loop

During code investigation, we identified a potential infinite mutation feedback loop in:

"public/scripts/i18n.js"

The internationalization system used a "MutationObserver" to monitor DOM changes.

The observer watched:

  • "childList"
  • "characterData"
  • "subtree"

The problem was that the observer callback could trigger "applyLanguage()".

However, "applyLanguage()" also modified DOM text nodes.

This created the following cycle:

  1. MutationObserver detects a DOM change.
  2. Its callback invokes "applyLanguage()".
  3. "applyLanguage()" updates text nodes.
  4. Those updates generate new DOM mutation records.
  5. MutationObserver detects those changes again.
  6. The process repeats.

This feedback loop could generate continuous JavaScript work on the main thread, making the browser increasingly unresponsive.

  1. The Fix

The main fix was to prevent the observer from monitoring DOM mutations produced by "applyLanguage()" itself.

The implementation now:

  1. Disconnects the observer before language-related DOM updates.
  2. Executes "applyLanguage()".
  3. Reconnects the observer in a "finally" block.

This ensures that the observer is reattached even if the update encounters an exception.

We also removed a duplicate delegated "change" event listener and kept the language selector's direct event handler.

Regression checks were added to the performance audit script to help prevent this issue from returning.

  1. Deployment and Initial Verification

After the changes:

  • The production deployment reached READY status.
  • The CI pipeline completed successfully, with 15/15 checks passing.
  • A user tested the production website on a laptop for approximately 15 seconds and did not observe the previous freezing behavior.

Mobile-device verification is still needed before considering the incident fully resolved.

  1. Lessons Learned

This incident reinforced several important engineering lessons:

  • DOM observers need careful handling when their callbacks modify the DOM.
  • A small feedback loop can become a major production performance problem.
  • Performance testing should cover different device categories.
  • Regression checks should protect against previously identified bugs.
  • User reports can be valuable evidence during production incident investigations.

A website can pass a build while still having runtime problems. Production behavior matters just as much as successful compilation.

AI Assistance Disclosure

The initial root-cause investigation was assisted by OpenAI GPT-6 Luna(ChatGPT).

The suspected feedback loop was then examined against the actual source code, and the fix was implemented with corresponding regression checks and deployment verification.

AI assistance was part of the debugging process, not a substitute for inspecting the implementation and validating the result.

Final Note

This incident started with reports from users who simply wanted to access a website.

It ended up revealing an important JavaScript performance issue that was not immediately obvious.

Debugging is not just about finding errors. It is about understanding how software behaves in the real world.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.