Hang Resistance in IE9

IE9 is the most reliable browser available today in terms of hang resistance. In this post on IE reliability, we show how we engineered IE9’s hang resistance so that an unresponsive tab no longer affects the rest of the browser, similar to how IE is resistant to a crashing tab with Tab Isolation. We highlight new user experiences that help you recover from hangs caused by Web pages, long- running scripts or slow add-ons so that you can browse continuously without interruption. We also perform a competitive analysis of IE9’s hang resistance to other browsers. You can use our Test Drive demo or watch this video to check out IE9’s hang resistance in action.


Understanding IE’s Hang Resistance

Next to crashes, hangs are the most common source of user disruption in applications. When an application hangs (or “freezes”), the entire user interface becomes unresponsive. Browser hangs are equally unpleasant. In earlier IE versions, when a tab hangs, you could not interact with the other open tabs or browser windows. When a site hangs in a tab in IE9, the rest of the browser remains unaffected. Let’s dig into some IE internals to understand how this works.

Like other browsers, IE’s browser frame window and its tabs are separate components. They communicate with each other via a shared message queue. When you perform actions like clicking a link on a tab or dragging the IE window, IE adds these actions as messages into the queue. Each message has a desired recipient. The frame window and tabs process the series of messages in order.

Browser hangs will occur when the message queue becomes stuck. For example, a tab becomes unresponsive due to a plug-in, so the tab cannot process any messages designated for itself in the shared queue. This holds up the other messages in the queue, creating a traffic jam effect. As you fruitlessly click around the browser, your actions generate messages that get queued up but won’t be processed since the hung tab still hasn’t processed the current message!

IE9 doesn’t allow this traffic jam to occur. The frame window periodically checks on the tabs to see if they’re hung. When the frame finds out that a tab is hung, it detaches the messages for that tab into a temporary location. This frees up the queue and the other tabs and the frame window can continue to process their messages while one of the tabs is still hung.

20110405-hrii-image1.png


When the hung tab is responsive again, it answers the frame window’s earlier check. Once the frame window receives the response from the now-responsive tab, it moves the messages for the previously hung tab back into the queue so that the tab can process them again.

In rare cases where IE9’s hang resistance cannot prevent the rest of the browser from hanging, the Windows Hang Experience kicks in. This is the same experience as IE8 and other browsers.

Take a look at the following diagram to understand how IE9 provides a hang-resistant user experience:

20110405-hrii-image2.png


A tab houses its own instances of toolbars, BHOs, and plug-ins, as well as the scripts and HTML code required to display the Web page. If any of these components hang the tab, the message queue jams, making the whole browser briefly unresponsive. It takes the frame window under 3 seconds to detect that the tab is hung and detach its messages from the queue. Once that occurs, then only the contents of that tab (colored orange) are unresponsive. The other components are not affected and continue to function properly.

This experience is an immediate improvement over other browsers and earlier versions of IE. The browser is more reliable and responsive. Sometimes you may not even be aware that one of your tabs is hung.

Since the browser frame remains responsive, IE9 also provides you with the ability to recover from hangs caused by the Web page, plug-ins, long running scripts or add-ons. In the following sections we describe the user experience for these scenarios.

Recovering from Web page and Plug-in Hangs

We designed the hang recovery experience to stay out of your way while you’re browsing. When the Web page or one of its plug-ins causes a hang, the contents of the tab naturally become unresponsive. There are no other immediate indicators that a hang has occurred. You can continue browsing in other tabs. You can close the tab, refresh the tab or even navigate to another Web page if you don’t feel like waiting for the Web page to respond.

When the tab remains unresponsive for 8 seconds after the frame window detects it to be hung, it is likely permanently hung. In that case you may want to recover the contents of the hung tab. IE displays the hang recovery notification for that tab when you interact with the tab.

20110419-hrii-image3.jpg


The notification makes it clear that the Web page in the tab is not responding. Additionally, IE dims the title text for that tab to indicate that it is hung. This helps remind you that the tab is hung if you decide to continue browsing in your other tabs.

Pressing the “Recover Web page” button on the notification initiates tab recovery for the hung tab process and sends an error report for the hang in the process. The other tab processes remain unaffected. As we’ve previously discussed, these error reports are crucial to identifying the top hangs to address and fix.

20110419-hrii-image4.jpg


Once the hang recovery notification appears, the following actions on the hung tab will also send an error report for the hang:


  • Closing the tab
  • Refreshing the tab
  • Navigating to a different Web site on the tab
  • Closing the IE window
If the tab manages to recover from the hang by itself, the notification disappears and the title text returns to normal.

Recovering from Script Hangs

Long-running scripts are another source of hangs in browsers. In earlier IE versions, IE halts script execution and displays the long-running script dialog once the script has executed a given number of instructions without reaching completion. IE needed to use this mechanism to detect the long-running script since there was no generic hang detection available back then.

With IE9 hang resistance, we no longer need the instruction-based detection mechanism and can now deliver a significantly improved user experience. When a long running script hangs a tab, it no longer affects the rest of the browser. Once the frame window identifies that the tab is hung, you can press the Stop button on the address bar (or the Esc key) to stop running the script. The Web page becomes responsive immediately and you won’t lose any of the data you may have entered on the page. However, the Web page may not function properly since IE has halted script execution.

Once the tab remains unresponsive for 8 seconds, clicking on the tab displays the long-running script notification:

20110419-hrii-image5.png


Pressing the “Stop script” button stops the script execution immediately. The rest of the user experience is identical to that of Web page hangs. For example, if you navigate to a different Web page on the currently script-hung tab, IE will stop running the script and proceed with the navigation.

Recovering from Add-on Hangs

The Add-on Performance Advisor integrates with hang resistance to help you recover from hangs caused by browser add-ons in IE9. As we previously discussed, some add-ons can take a long time to initialize when you launch IE or open a new tab. Since the tab cannot continue instantiation until its add-ons have finished loading, a really slow add-on will cause the tab to hang. As with the other types of hangs, the rest of the browser will not be affected by the slow add-on.

When the frame window detects that a tab is hung, it also checks to see if an add-on is being instantiated in the tab. If that’s the case, IE displays a variant of the slow add-ons notification once you click on the unresponsive tab. Clicking “Choose add-ons” on the notification invokes a variant of the Choose Add-ons Dialog which shows you the add-on that’s currently loading.

20110419-hrii-image6.jpg


You can keep waiting for the add-on to load or disable the currently loading add-on so that you continue browsing. You can also disable the other add-ons that are currently enabled. Once you disable your add-on(s) and press “Recover Tab” in the dialog, IE commits the changes to your add-ons and recovers the hung tab. With this new functionality your browser will no longer be permanently affected by add-ons that have significant performance issues.

Hang Resistance in Other Browsers

A modern browser should be resistant to hangs in its tabs, similar to how an operating system is resistant to hangs in its applications. Let’s take a look at how IE’s hang resistance and recovery functionality compares to the latest versions of other popular browsers available today.

Hang type IE 9 Chrome 10 Firefox 4 Opera 11 Safari 5 Web page hangs Plug-in hangs Script hangs Add-on hangs Legend: Full hang resistance — Hangs are isolated to the tab; rest of browser is not affected Partial hang resistance — Hangs are isolated to more than one tab; rest of the browser is not affected No hang resistance — Entire browser is affected by hang As you can see, only IE9 is fully resistant to the various types of hangs we tested in the above table. Additionally, IE9 gives you the ability to recover from all these types of hangs, such as by stopping a long-running script or by disabling a slow-performing add-on.

Google Chrome offers the next best resistance against hangs. Since Chrome isolates its plug-ins into separate processes, a plug-in hang will affect all the tabs that have that plug-in instantiated on their Web pages. Chrome also offers a hang recovery experience although it is slightly different from IE9. If the hang lasts for one minute, Chrome displays a modal dialog asking you whether to kill the page or keep waiting.

The remaining three browsers do not have built-in hang resistance functionality, although Opera is designed to be resistant to script hangs. It conducts its script execution in a separate thread so that a long-running script will not bring down the browser itself. Instead the script incurs a noticeable impact on the browsing performance across all tabs and windows. Since Opera’s add-ons are script-based, they inherit the same type of resistance against hangs.

Going Forward

IE9 is the only browser today that is fully resistant against tab hangs caused by Web pages, plug-ins, scripts or add-ons. These hangs no longer bring down the rest of the browser. IE9 also provides you with the ability to recover from these types of hangs. Coupled with improvements in IE’s crash reliability and add-on ecosystem reliability, IE9 is the most reliable version of IE we’ve ever shipped.

The Web and the add-on ecosystem will continue to evolve in the months to come. We will continue to find and address the top crashes and hangs that you report to us through Windows Error Reporting. We’ll deliver these fixes to you through Cumulative Updates to ensure that we maintain IE9’s reliability for everyone.

Thanks again for using the IE9 pre-releases, submitting your feedback and sending us your error reports to help us drive reliability throughout the product cycle. We look forward to delivering additional reliability improvements to IE in the future!

—Herman Ng, Program Manager, Internet Explorer Fundamentals


aggbug.aspx

More...
 
Back
Top