Hi, Monks, I beg your wisdom. I have below leg of code. I execute in rc3 script. When it comes to line 12 it seems the script hangs there for more than 20 hours. See detailed log information below the code. Please be aware that I execute this script in various machines without any problems. Only in this IBM machine with InReach TTY console connected I get this issue.

1 sub ptrace { 2 my ($msg, $level) = @_; 3 $msg = pdate()." ".$msg; 4 ptrace_wo_date($msg, $level); 5 } 6 7 sub ptrace_wo_date { 8 my ($msg, $level) = @_; 9 $level = defined $level ? $level : $norm_trace; 10 if ($traceLevel >= $level) { 11 if ($ttymode) { 12 print "$msg\n"; 13 } 14 if ($log_opened) { 15 print $logfh "$msg\n"; 16 } 17 } 18 } 19 20 sub plog { 21 my $msg = shift; 22 if ($ttymode) { 23 $msg = pdate()." ".$msg; 24 } 25 if ($log_opened) { 26 print $logfh "$msg\n"; 27 } 28 } 29 30 # Main part 31 32 my $pit_trace = "/tmp/pit.trace"; 33 my $cmd = "/tmp/FMinstall.sh" 34 ptrace("-I- executing: \n\t$cmd"); 35 system("$cmd > /tmp/instappcmd.out 2>&1"); 36 my $res = $? >> 8; 37 my $pitres = readFile("/tmp/instappcmd.out"); 38 unlink "/tmp/instappcmd.out"; 39 40 # log result and pit trace if any 41 ptrace(" execution trace:\n$pitres"); 42 43 if ( -f $pit_trace ) { 44 $pitres = readFile($pit_trace); 45 plog($pitres); 46 }

Below is the log from the above code. Lines 1 and 2 are print on 2/14, and it hangs there. After 20 hours when I login into the console of the machine lines 4 and later come out. From the time stamp on line 4 we can see the 3rd line of code should be executed on 2/14, then the code goes into the ptrace_wo_date() function, and comes to code on line 12, but it hangs there for 20 hours when I login on 2/15 it resumes. Then the code comes to line 45 and plog() prints the time stamp in below log line 21, which is 2/15.

My question is what is the possible reasons for the print() hangs. Why it resumes when I login on the console. I am on IBM machine with Console Access through terminal Server InReach MRV Port 3122. Appreciate your any comments on this in advance.

1 2013/02/14 16:25:20 -I- executing: 2 /tmp/FMinstall.sh 3 4 2013/02/14 16:50:12 execution trace: 5 6 Execution of FMinstall.sh ... 7 8 2013-02-14 16:25:22 INFO Stopping FM 9 2013-02-14 16:25:22 INFO FM instance name: player1 10 Last login: Thu Feb 14 16:24:16 GMT 2013 on console 11 Instance player1 is already in the STOPPED state. 12 Last login: Thu Feb 14 16:24:16 GMT 2013 on console 13 2013-02-14 16:25:23 INFO FM Stopped 14 15 -I- Stopping FM player2 instance 16 17 2013-02-14 16:25:23 INFO Stopping FM 18 2013-02-14 16:25:23 INFO FM instance name: player2 19 ... ... 20 21 2013/02/15 12:33:27 2013/02/14 16:50:12:Audit:event(2)::SYSTEM +():================================================== 22 2013/02/14 16:50:12:Audit:event(2)::SYSTEM(): Starting the Aud +it tool. 23 2013/02/14 16:50:12:Audit:event(2)::SYSTEM():================= +================================= 24 2013/02/14 16:50:12:Audit:debug(4)::RepositoryXml.parseReposit +oryFile():Reading file </usr/repository/products.xml>. 25 2013/02/14 16:50:12:Audit:debug(4)::Repository.Repository():Co +ntent of repository :


In reply to print() function hang for long time by dengguochen2003

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.