Penerjemahan ini sedang berlangsung.
In order to help protect users from plugins and plugin scripts that stop responding, Firefox now includes a "hang detector," which watches for plugins that have stopped working.
How it works
When Firefox makes an NPAPI call to a plugin which is running in its own process, the NPAPI call is translated into an inter-process communication (IPC) request that is posted to the process. Firefox then waits for the response. If a response is not received within a given amount of time (by default, this is 45 seconds), the plugin is assumed to have locked up, and Firefox terminates the plugin by following these steps:
- The plugin's process is stopped and a plugin-process "crash" mini-dump is retrieved.
- A "crash" mini-dump is collected from the main browser process.
- The plugin's process is terminated.
- The crashed plugin user interface is displayed; this interface lets the user choose to reload the page and try again.
What triggers the hang detector?
There are several possible situations that can trigger the hang detector:
- A plugin script—such as ActionScript code running in the Flash plugin—may be in an infinite loop or is performing an extremely long computation without yielding control.
- The plugin itself may have a bug such as a threading deadlock, which caused it to stop responding.
- The plugin isn't deadlocked, but isn't processing events quickly enough, causing a backlog that eventually causes an event to wait too long to be processed.
- The implementation of Firefox out-of-process plugins has a bug causing a deadlock.
What happens to the hang report?
When the hang detector catches a problem, it gathers up the mini-dumps and submits the data to crash-stats, providing handy debugging information to developers so that the problem can be categorized and, if possible, corrected. The advanced query page makes it possible to differentiate between crash reports and hang reports, and lets search results be limited to either the browser process or the plugin process. In addition, the browser hang report and the corresponding plugin hang report are automatically cross-linked for you.
What if I don't want to terminate hung plugins?
Sometimes developers may want to prevent hung plugins from being terminated; this could be useful, for example, while debugging script code in Flash or if you're using a debugger that causes event processing to be delayed (such as the Flash debugger).
You can change the timeout period used by the hang detector by changing the value of the
dom.ipc.plugins.timeoutSecs preference. The value of this preference indicates the number of seconds an event response must take before the plugin is considered to be hung.
Setting this preference to -1 disables the plugin hang detector entirely.
See about:config on MozillaZine for information on changing preferences like this one.