-
Notifications
You must be signed in to change notification settings - Fork 36
"command error: Resource temporarily unavailable (os error 11)" when processing a lot of files #19
Comments
For comparison, GNU parallel is limited to 15Mb of RAM on my system on the same workload. |
I'll be landing a large amount of changes soon that refactors a decent portion of the source code and adds quiet mode, and once that is done I'll look into how I can improve the resource consumption of inputs. I may need to remove the feature of counting the total number of jobs and use an iterator for reading inputs from standard input. |
Spent a whole day trying to fix a bug when it was actually caused by the beta and nightly compiler. Anyway, I've landed the changes that I meant to land yesterday, so now I will begin to work on handling standard input in a more efficient manner. |
Ah, I should have warned you about the nightly compiler - I've already figured out that it's buggy with your parallel. I've already tried Also, in 0.4.1 your parallel was 2x slower than GNU parallel when reading arguments from stdin. |
Updating the issue to say that I have Nightly builds fixed by eliminating the I plan to solve the issue by buffering 64K worth of arguments at a time and writing the arguments to disk in an |
I'm pretty close to resolving this problem. The issue of memory is fixed with my local changes now that inputs are being buffered to and from the disk into byte arrays. However, I've yet to resolve the issue of OS Error 11 as that's being caused by Rust failing to close child processes for some reason. I'm not sure how to ensure that child processes are closed so I'm asking the community for help with this issue. |
Processes that you're done working with stay around as zombie processes; this means that they have terminated, and the only thing left from them is an entry in the process table and the exit code. As soon as the exit code is read by This is done by |
I've been able to fix it by borrowing the Child process as a mutable reference and then borrowing the child's fields with the It will still be a while before I push the fixes though. I'm in the middle of refactoring a large portion of the code I've written so far, which has caused some bugs that I'm having to track down. |
The good news is that I just successfully processed 100,000 inputs, |
Later today I'll have the changes landed for you to test out. It's going to be quite the update.
And some benchmarks: Rust Parallel
GNU Parallel
|
The new release has been made, so you can try it out to see if it's working as you like. |
It doesn't seem to leave a lot of zombie processes around anymore. Huzzah! Tried it on 10,000 files so far, and it's now significantly slower on a simple 'cat' workload than gnu parallel. The command line is:
Runtime and peak memory usage for each: Additionally, the memory usage for Rust parallel grows over time while GNU parallel uses a fixed amount of memory. For the record, the regular use case for this is piping all that stuff to grep instead of /dev/null to get aggregate statistics for the entire dataset. |
This issue is resolved by 0.5.0 release. |
Shall I open another issue for the lack of performance parity with GNU? |
It should be opened as a bug. I'm guessing that memory consumption is rising because the standard output and error of each task is being temporarily buffered into memory, and subsequently dropped from memory after that process has had it's turn being printed. The solution will be to modify the piping to use the |
I think you'll find with the latest version, |
When invoking Parallel 70,000 files with filenames piped on stdin, its memory usage grows continously up to 0,5Gb of RAM, and when it stops growing Parallel starts spamming the following line:
parallel: command error: Resource temporarily unavailable (os error 11)
Happens both with and without
--no-shell
argument. Command line to reproduce the issue:find '/some/folder/with/tens/of/thousands/of/files' -type f | 'target/release/parallel' -j 6 cat '{}' > /dev/null
Parallel built from git with
cargo build --release
on Linux x86_64, rustc 1.11.0 (9b21dcd6a 2016-08-15)The text was updated successfully, but these errors were encountered: