Closed
Bug 564965
Opened 16 years ago
Closed 10 years ago
Uploading using socket API uses high CPU on larger files
Categories
(Core :: Networking: File, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: mimecuvalo, Unassigned)
Details
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2
Build Identifier:
From one of my extension's users (among others):
I'm using firefox 3.5.1 and fireftp 1.0.5. When I tried to upload a huge file
(700MB or so) to a ftp server, the memory firefox consumed began to build up
quickly (1MB per second)and the CPU usage was high (80% or so). It was not long
before my operating system, which is ubuntu 9.04, became to hang (probably due
to lack of free memory). If I canceled the upload by pressing the 'abort'
button when the system was still responsive, the memory and cpu usage would
immediately drop to a low level.
My code does the following:
var dataBuffer = this.dataInstream.readBytes(this.dataInstream.available() < 4096 ? this.dataInstream.available() : 4096);
this.progressEventSink.dataOutstream.writeBytes(dataBuffer, dataBuffer.length);
Even on my new Mac, my CPU starts to strain on large files (was testing with files around 400MB or so).
Reproducible: Always
Steps to Reproduce:
1. Install FireFTP extension
2. Upload large file (say 400MB)
3. Watch large CPU usage
Hi, I'm the one who reported the original bug with FireFTP and I can still confirm this with my 64-bit Kubuntu 9.10 and Firefox 3.6.5pre.
Comment 2•16 years ago
|
||
Is SSL used for connection? ( http://en.wikipedia.org/wiki/FTPS )
If yes, see Bug 559676 for high CPU part.
Comment 3•16 years ago
|
||
You might want to use nsIAsyncStreamCopier to copy the data from dataInstream to dataOutstream
Comment 4•16 years ago
|
||
> var dataBuffer = this.dataInstream.readBytes(this.dataInstream.available() <
4096 ? this.dataInstream.available() : 4096);
> this.progressEventSink.dataOutstream.writeBytes(dataBuffer, dataBuffer.length);
In a loop? Or does it write the one 4k buffer and then wait for a while?
| Reporter | ||
Comment 5•16 years ago
|
||
@WADA No, it is a regular non-SSL connection
@Christian I will give it a try.
@Boris in progressEventSink.onTransportStatus it will write another 4kb and then keep calling that function over and over in 4kb chunks. In the past I've used higher buffer sizes but for some reason that caused instability if I recall correctly. I can try again to increase the size to 16 or 32kb.
The code is here: http://www.mozdev.org/source/browse/fireftp/src/content/js/connection/dataSocket.js?rev=1.53
Comment 6•16 years ago
|
||
Hmm. So you're only calling this onTransportStatus; you should be unwinding to the event lop between calls, I'd think.
I wonder what's using up the memory that you see being used up...
| Reporter | ||
Comment 7•16 years ago
|
||
> you should be unwinding to the event lop between calls, I'd think.
Not sure what that means...
Comment 8•16 years ago
|
||
> Not sure what that means...
Just means that based on at least casual inspection this code should work (in the sense of not having to buffer up all the data in memory).
Comment 9•10 years ago
|
||
assume closed based on 2/3 open again with new info as necessary
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•