Hi guys,
Thanks for your responses.
Here's the code flow:
Please note that error does not occur in case I run 3 child process. Even sometimes all 6 run without any error. Find the ulimit output below:
xxxx.pl:
======
#!/usr/local/bin/perl5 -w use strict qw(refs); require 5.001; use Getopt::Std; use Sybase::DBlib; use POSIX "sys_wait_h"; # Open database connections my $x = db_login( ... ) || die( "Could not open ..." ); my $xx = db_login( ... ) || die( "Could not open ..." ); my $xxx = db_login( ... ) || die( "Could not open ..." ); my $xxxx = db_login( ... ) || die( "Could not open ..." ); my %j = <data from DB> my %jj = <data from DB>; my %jjjj = <data from DB>; my $pid1 = &executeChild( ....... ); my $pid2 = &executeChild( ....... ); my $pid3 = &executeChild( ....... ); my $pid4 = &executeChild( ....... ); my $pid5 = &executeChild( ....... ); my $pid6 = &executeChild( ....... ); print "Waiting for forked processes to finish...\n"; waitpid($pid1,0); waitpid($pid2,0); waitpid($pid3,0); waitpid($pid4,0); waitpid($pid5,0); waitpid($pid6,0); print "Done waiting, all forked processes have finished...\n"; exit 0; sub executeChild { my $fork_pid=fork(); if( $fork_pid != 0 ) { return $fork_pid; } # open 4 more db connections to get some data $gg = db_login( .........) || die( "Could not open ........." ) +; $ggg = db_login( ......... ) || die( "Could not open ........." +); $gggg = db_login( ......... ) || die( "Could not open ........." +); $ggggg = db_login( ......... ) || die( "Could not open ........." + ); # open 3 files here - child specific open(Some_File_Handler1, ">some_file_name1") || die ("Failed"); open(Some_File_Handler2, ">some_file_name2") || die ("Failed"); open(Some_File_Handler3, ">some_file_name3") || die ("Failed"); #TILL This point no error, error occurs after this point at some r +andom place for ( over 270k items) { do some processing, involving hashmap manipulation, and writin +g out data into 3 files } do some more processing - involving array/hashmap xx. call three external programs [system(...)]to work on the writt +en out files. read in files generated in xx step. do some more processing open 3 final output files write out 3 final output files }

ulimit output

core file size (blocks) unlimited
data seg size (kbytes) unlimited
file size (blocks) unlimited
open files 1024
pipe size (512 bytes) 10
stack size (kbytes) 8192
cpu time (seconds) unlimited
max user processes 29995
virtual memory (kbytes) unlimited

I ran the program by increasing the ulimit to 16M but no luck!
System free disk space is significantly high..4-5G, and the files that are being created are quite small in size ( total size of all the files may be 1G or so)
The way I am checking for error is by following code snippet:
if ($!) { print "Error occured: $!"; # reset the error so that we can catch next genuine error cond +ition $! = 0; }

Note that after this piece prints error ( which means the program ran out of memory, program still runs (remaining passes of the loop, other child processes) and there is no error for sometime. Error is generated ( though not always) again after sometime. So if the error was precisely due to some concrete memory issue then once error is generated (momory exhausted) all 6 child processes should fail to proceed and all of them should throw the same error. Which is not happening!!!

Edited by davido to add code and readmore tags.


In reply to Re^2: Error: Not enough space by jhazra
in thread Error: Not enough space by jhazra

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.