Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

does following code cause system crash

Status
Not open for further replies.

subtelo

Programmer
Jan 9, 2005
25
US
For more than one time, once I run the following code to untar several files (total ~4G), the remote server always crash. I use ssh to reach remote server. The final data is around ~30G. I am wondering does this code cause memory leak? Or it eat all CPU space? I do not have any knowledge regarding the hardware.
ANY input is appreciated.

############
#!/usr/bin/perl

use strict;

foreach my $i (0..59)
{
my $com = "tar -xvzf data$i.tgz";
`$com`;
}
############
 
Multiple 'my' declaration may cause problems.
try -
Code:
############
#!/usr/bin/perl

use strict;
[red]my $com;[/red]
foreach my $i (0..59)
{
    $com = "tar -xvzf data$i.tgz";
    `$com`;
}
############

Keith
 
Hmm, you are right. Multiple valuables may take more memory.

Any other comment?
 
Everything is fine when I only tar a single file. And all files are exist.
Every time after i ask the server admin to rebuilt the server, the script will go through and untar all files without any problem.
Next time I use the same code to untar same other different data, same problem will happen again.
 
Woo, there is a typo. What I mean is that I ask the server admin to reboot the server. Sorry for the misleading.
 
Use the full path to tar

The first code is correct. Using my in the loop localizes $com to inside the loop.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
I posted before without actually reading your whole problem. I would check out the size of the .tgz files. Maybe there are more files or bigger files than you expect. I would add a check to see if the file exists ( -e ) before trying to untar it.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top