3

我遇到了 IE7 挂起访问我的网络应用程序的情况。根据George V. Reilly的出色建议,我安装了 WinDbg 来下载 IE 符号,设置 Process Explorer 以使用这些符号,然后使用 Process Explorer 获取挂起线程的堆栈跟踪。

我在下面粘贴了堆栈跟踪。更熟悉 IE 内部的人是否知道正在发生的事情,或者对如何进行此操作的建议?

ntkrnlpa.exe!KiUnexpectedInterrupt+0x8d
ntkrnlpa.exe!PsDereferencePrimaryToken+0x362
ntkrnlpa.exe!KiDeliverApc+0xb3
ntkrnlpa.exe!KiDispatchInterrupt+0x5a2
ntkrnlpa.exe!SeOpenObjectAuditAlarm+0x1ce
mshtml.dll!CTreePos::GetCp+0x5a
mshtml.dll!CFlowLayout::GetNestedElementCch+0x7d
mshtml.dll!CDisplay::FormattingNodeForLine+0x1d5
mshtml.dll!CFlowLayout::LineStart+0xdb
mshtml.dll!CDisplayPointer::GetLineStart+0x44
mshtml.dll!CDisplayPointer::IsAtBOL+0x4e
mshtmled.dll!CCaretTracker::PositionCaretAt+0xf9
mshtmled.dll!CCaretTracker::Init2+0x54
mshtmled.dll!CSelectionManager::SetCurrentTracker+0x26
mshtmled.dll!CSelectionManager::CreateTrackerForContext+0x1c0
mshtmled.dll!CSelectionManager::SetEditContext+0x8b
mshtmled.dll!CSelectionManager::SetEditContextFromElement+0x2ed
mshtmled.dll!CSelectionManager::EnsureEditContextClick+0x343
mshtmled.dll!CSelectionManager::HandleEvent+0xb9
mshtmled.dll!CHTMLEditor::PostHandleEvent+0x89
mshtml.dll!CDoc::HandleSelectionMessage+0x1e0
mshtml.dll!CDoc::PumpMessage+0xb69
mshtml.dll!CDoc::OnMouseMessage+0x3d7
mshtml.dll!CDoc::OnWindowMessage+0x748
mshtml.dll!CServer::WndProc+0x78
USER32.dll!InternalCallWinProc+0x28
USER32.dll!UserCallWinProcCheckWow+0x150
USER32.dll!CallWindowProcAorW+0x98
USER32.dll!CallWindowProcW+0x1b
IEDevToolbar.dll!DllUnregisterServer+0xe21d
USER32.dll!InternalCallWinProc+0x28
USER32.dll!UserCallWinProcCheckWow+0x150
USER32.dll!DispatchMessageWorker+0x306
USER32.dll!DispatchMessageW+0xf
IEFRAME.dll!CTabWindow::_TabWindowThreadProc+0x189
kernel32.dll!BaseThreadStart+0x37
4

2 回答 2

3

Based on the stack trace, it is in the middle of altering the DOM. As commented on your previous post, IE is extremely inefficient when doing both reads and writes on the DOM (when compared to Firefox and Chrome.)

The performance problems can be tackled by reducing and optimize both the reading and the writing of the DOM by:

  1. navigating the DOM using simple DOM properties and methods whenever possible (Document.getElementById, DomElement.parentNode, DomElement.childNodes[], DomElement.nextSibling, etc.) instead of the XPATH (CSS) selector methods (DomElement.querySelector)
    • this is because querySelector behaves O(N) under IE, where N is the size of the entire DOM - that is, you will pay the penalty of traversing the entire DOM even if you call querySelector on a leaf node that has no children!
    • if you trigger one or more querySelector calls for each element in a considerable subset of the DOM, you are essentially paying O(N^2) penalty
    • note that YUI's YAHOO.util.Selector.query, Prototype's element.down, element.up, element.select all use the querySelector call internally
  2. altering the UI behavior, if possible, to skip or defer as much DOM traversal and modification as possible
    • present as little information at a time; force the user to click (e.g. on expand links etc.) in order for you to proceed with additional processing/modifications
  3. switch away from Javascript, to Flash or Java.

Given that you are using YUI you may not have a lot of latitude as far as option 1 goes, and I can imagine that option 3 is almost certainly a non-option for you. Which unfortunately leaves option 2.

于 2009-02-23T03:16:29.263 回答
1

它挂在所有浏览器中还是只挂在 IE7 中?

对我来说唯一突出的是“IEDevToolbar.dll!”

另外...可能是您的应用程序做了不应该做的事情。

于 2009-02-23T02:24:35.457 回答