Closed Bug 270312 Opened 20 years ago Closed 17 years ago

High cpu usage (100%) when downloading files of unknown size

Categories

(Toolkit :: Downloads API, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: alex.blank, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

I just recently noticed this problem after upgrading to Firefox 1.0

When I initiate a download, the CPU usage spikes to 100% until the download is
complete. Firefox becomes partially unrepsonsive -- I am able to interact with
the UI and click things and such, but there is no effect, the status bar simply
says "stopped". Once the download completes, if I had 'queued' something (i.e.
typed www.google.com into the address bar and hit enter) during the download, it
subsequently loads. 


Reproducible: Always
Steps to Reproduce:
1. Open Firefox
2. Download ANY file (I have broadband, so usually I download a file that is > 5mb)
3. Try to interact with original window. For example, try clicking a link or
typing something new into the address bar.

Actual Results:  
As expected, my CPU usage spiked to 100% for the duration of the download, and
the user interface became unresponsive until the download finished.

Expected Results:  
Not used so much CPU time, UI should have stayed responsive.

For other people experiencing the same problem, and anecdotal confirmation, see
my post on the forums at: http://forums.mozillazine.org/viewtopic.php?t=165410
Same problem on Win2k SP4.  Doing a download can consume minutes of CPU time. 
Doing a "cleanup" operation using the download manager button seems to be an
infinite loop (I gave up after 45 minutes of CPU time) and comsumes over 100 MB
of RAM and VMspace!

Reporter of this comment is David Taber, davofanmail@comcast.net.  Using Firefox
1.0 on Dec 1 2004
oooh, discovered problem and solution...plus a need for an RFE!

Symptom is caused by download manager's trying to deal with a huge list of
downloads, most of which are historic.  The downloads history trail is kept in
(for windows) WINNT\Application Data\Mozilla\Filefox\Profiles\#######.default\
and it grows by a couple of hundred bytes for every download you've EVER done.

When you install Firefox, and you import all the settings from an existing
Netscape instance you get maybe a couple of megs of XML in the download history.
The DM code is obviously doing some linear searches and reparsing the XML every 
time (how thoughtful!  how thorough!), so even deleting a single entry can take
minutes of CPU time.

The work-around:  empty this file!  Performance gets better (do the same thing
for Netscape's file -- it'll get snappier too).

The RFE:  this file should be truncated when it gets more than X days old, or 
Y kB, or something.  As far as I'm concerned, this file can be deleted every
time I reboot.  Not sure why anyone would want this historical information other
than spyware (which sites HAVE you been downloading from, anyway??)

(davofanmail@comcast.net)
Windows XP SP2 here. C:\Documents and Settings\account\Application
Data\Mozilla\Profiles\kqetc.slt\ -directory, downloads.rdf is 73KB, largest file
is XUL.mfl (1670 KB, seemingly nothing to do with downloads?) all other files
less than these two.

So that would not seem to be the case.

How ever, whenever I download something, I can't really do anything with the
browser (nightly build of 041122) until the download is finished. I recall once
having gotten pretty good with right-click::download::enter -combination, but
now I can't apply that. Only single tasking with Firefox...
I've found the same behaviour on Windows 2000 - deleting downloads.rdf (which
had reached 1900 KB) solved the problem. I agree with the poster who suggested
having this file automatically truncated at a given time/filesize to prevent
this behaviour from developing. 
I just ran into the same problem on linux.  I started downloading 5 or 6 mp3s,
7-20MB in size, and then opened a terminal to watch a video clip.  I noticed
that the video was dropping frames so I ran top to check on the cpu.  It
reported that X was taking up 90+% of the cpu (for some reason, it reports X as
taking up the cpu not firefox-bin).  I ran some tests and found that this
happens when several downloads (4 or more) are happening at once (and obviously
the size of the downloads is a factor as then the simultaneous downloads take
longer, unlike quick jpeg downloads).  Earlier versions of firefox seemed to
have a limit built in where you could have only two active, simultaneous
downloads and it appears that this limit has been removed recently, leading to
the current problem.  (Although, the same limit seemed to be in place when I
tried to download more than two 40+ MB files.)  I emptied out my downloads.rdf
as reported above and it didn't change anything.  I was able to reproduce the
problem with a practically empty downloads.rdf file.  Perhaps this is because of
the download animation used, because it shows 90% cpu utilization by X and not
firefox-bin.  This is very reproducible and should be labeled as confirmed, at
least on linux.
I agree with #5. On linux, firefox-bin takes up 100% CPU when the download
manager is open, and there are a few files at download.

Most of the files I've notices were of an unknown size, thus showing the gliding
progess bar, and not the regular progress bar.

This CPU usage is not present when the progress bars aren't shown, or when they
are, but not gliding (as they are when the download manager is opened in the
middle of a download of an unknown size).
*** Bug 306570 has been marked as a duplicate of this bug. ***
*** Bug 315518 has been marked as a duplicate of this bug. ***
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc4 Firefox/1.0.7 ID:2005092215

I am getting the same problem as in comment #5 and comment #6. Top reports firefox-bin as taking 90% cpu while downloading a few files of unknown size. The second I close the downloads dialogue it drops down to ~0%. I have recently cleared my entire ~/.mozilla directory but the problem remains.
I can confirm the original bug affects Firefox RC2 (Gecko 20051107) on OS X 10.4.2.

Also, doesn't seem as if comments 5, 6 and 9 are referring to another issue?
Assignee: bugs → nobody
Severity: critical → normal
OS: Windows XP → All
QA Contact: aebrahim-bmo-507 → download.manager
Hardware: PC → All
Summary: CPU usage spikes to 100% for duration of a download → High cpu usage (100%) when downloading files of unknown size
Version: unspecified → Trunk
*** Bug 313969 has been marked as a duplicate of this bug. ***
*** Bug 270679 has been marked as a duplicate of this bug. ***
(The long download history bug is something else, I've morphed this one into the unknown file-size bug)
Which bug number has been assigned to download history bug?
Unknown filesize perf/status bug is 123334 (progressbar is updated too often).
History perf issue could be bug 240525.
Depends on: 123334
WORKSFORME on Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9b5pre) Gecko/2008031104 Minefield/3.0b5pre
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
sdwilsh: I almost think I've seen this recently... but I could be hallucinating. Do you have a testcase, since apparently no one posted one the entire time this bug was active?
I had one earlier, but I don't recall the url offhand (and it was a test profile, so I don't have it handy in my history) :(
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.