Closed Bug 718936 Opened 13 years ago Closed 8 years ago

firefox freeze while loading page with a large number of file:// links

Categories

(Core :: General, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: shaohua.wen, Unassigned)

References

Details

(Keywords: regression, Whiteboard: [snappy:P2])

Attachments

(2 files)

Attached file (deleted) —
Firefox 9 is frozen while loading attached html page with a big table.

Tested with Fx 3.6 in Linux, works fine.
I can reproduce on
http://hg.mozilla.org/mozilla-central/rev/f4049f65efc6
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0a1) Gecko/20120118 Firefox/12.0a1 ID:20120118031059

But not on
http://hg.mozilla.org/mozilla-central/rev/f4049f65efc6
Mozilla/5.0 (X11; Linux i686; rv:12.0a1) Gecko/20120118 Firefox/12.0a1 ID:20120118031059

Regression window
Works:
http://hg.mozilla.org/mozilla-central/rev/ad9729975289
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a2pre) Gecko/20100224 Minefield/3.7a2pre ID:20100224075828
Hangs up for a while:
http://hg.mozilla.org/mozilla-central/rev/639b98ae11a8
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a2pre) Gecko/20100224 Minefield/3.7a2pre ID:20100224094223
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=ad9729975289&tochange=639b98ae11a8

In local build,
First bad : Shawn Wilsher — Bug 461199 (Part 13) - mozilla::dom::Link::SetLinkState should inform the document 
                                      about changes to its state when it is called. Make Link::SetLinkState notify the document
                                      about changes in state, plus a whole bunch of assertions for sanity checking. r=sicking r=bz
Last good : Shawn Wilsher — Bug 461199 (Part 12) - mozilla::dom::Link should unregister with mozilla::IHistory 
                                       when it goes away Call UnregisterWithHistory in Link's destructor to ensure that we are no 
                                       longer registered with IHistory. r=sicking sr=bz
Hmm.  I must be missing something...  When I load the page involved in either Firefox 9 or current trunk on Mac, I see no freeze.  Is this Windows-only?  Reporter, do you see this on Linux with a current build?
Check nightly build 12.0a1 (2012-01-18) on linux i686, no freeze.
(In reply to Boris Zbarsky (:bz) from comment #2)
> Hmm.  I must be missing something...  

FYI,
No hang up,if I commented out Link::ResetLinkState(false); in content/html/content/src/nsHTMLAnchorElement.cpp.
(Of course, though the state of the link will not function ...)

nsHTMLAnchorElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                                nsIContent* aBindingParent,
                                bool aCompileEventHandlers)
{
  //Link::ResetLinkState(false);
this should likely be profiled.
fwiw, I noticed sort of a hang on Win7 on the first load, next reloads didn't hang.
Whiteboard: [snappy]
OK.  So the hang is definitely Windows-only?

But the code that changed is cross-platform... what's special about Windows here?  Is the page browser-sniffing?
Attached file WinDbg log
Ah, interesting.  Is the freeze only visible when loading the page from a file:// URI, then?
OK.  What does the windbg sample from that freeze look like?
Er;
s/WinDbg log ( in case of open link of Comment#6 )/WinDbg log ( in case of open link of Comment#9 )/
That's.... very confusing.   That last log is still showing you under nsLocalFile::Equals

Can you maybe take a look at what the file path for that nsLocalFile (or the mSpec for the corresponding nsStandardURL) is?
this may explain why further reloads are faster? I assume files stats are cached. Having to go through GetFileAttributesW for each url comparison is a pain :(
FWIW I just found bug 394486
I wonder if we may rather check for ~ in both urls to detect a short name and, if none of them has one, just do a case insensitive comparison. Otherwise fallback to the current code.
Oh, I'd missed the file:// URIs in the testcase.  That explains things.  I bet it's not an issue on other OSes because nsLocalFile::Equals is just an strcmp on the two file paths there.

Would it make sense to have the Windows nsLocalFile::Equals first compare mWorkingPath values and only if those differ do the canonical path thing?  That should help this case, because we're doing a hashtable lookup, so chances are the paths are equal anyway if we're comparing them to start with...
Summary: firefox freeze while loading page with table (40 columns and 50 rows) → firefox freeze while loading page with a large number of file:// links
I fear that we'd hit far more difference than equality, especially when walking the hash. I suppose in most cases a page has all different file links.

I suppose we have to normalize because a working path may be in the long format and one in the short one, but both may point to the same file?
If so, we may use the fact short paths are always uppercase, so if mWorkingPath!=UC(mWorkingParh) for both files (none of them is a shortcut), there is no point in normalizing.
(In reply to Boris Zbarsky (:bz) from comment #18)
> Would it make sense to have the Windows nsLocalFile::Equals first compare
> mWorkingPath values and only if those differ do the canonical path thing? 
> That should help this case, because we're doing a hashtable lookup, so
> chances are the paths are equal anyway if we're comparing them to start
> with...

Absolutely!
Assignee: nobody → netzen
Whiteboard: [snappy] → [snappy:P2]
Unmarking myself until I start to work on it. I tried to reproduce it but didn't have success, if someone else wants it in the meantime feel free.
Assignee: netzen → nobody
The content of attachment 589424 has been deleted by
    Byron Jones ‹:glob› <glob@mozilla.com>
who provided the following reason:

Requested by creator in bug 735595

The token used to delete this attachment was generated at 2012-03-14 02:01:43 PDT.
Closing as incomplete because the testcase no longer exists. Fell free to reopen if you can still reproduce the issue and add a new testcase/testurl.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: