<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Infinite loop problem in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473407#M42642</link>
    <description>Hi, Dear Pramod,&lt;BR /&gt;The logic of the program I was tracking is like that:&lt;BR /&gt;  while (1) {&lt;BR /&gt;   call lib$find_file ( "*.csv", result buff,&amp;amp;context);&lt;BR /&gt;   if search result buff contains a "*" then&lt;BR /&gt;      return SS$_NORMAL;&lt;BR /&gt;   else&lt;BR /&gt;      rename the search result buff to "*.log"&lt;BR /&gt;   }&lt;BR /&gt;   call lib$find_file_end(&amp;amp;context);&lt;BR /&gt;&lt;BR /&gt;This logic has the following problems:&lt;BR /&gt;1. The while(1) loop only has one existance, when result buff contains a "*" char.&lt;BR /&gt;2. when breaking from the loop, faile to call lib$find_file_end.&lt;BR /&gt;&lt;BR /&gt;Usually, when no files, lib$find_file will return no file return value and the result buff is as same as input searching string(like "*.csv"), the logic seems to be no problem.&lt;BR /&gt;&lt;BR /&gt;So I imagined the situation should be as the following:&lt;BR /&gt;1) lack of lib$find_file_end will cause a vm leak.&lt;BR /&gt;2) the vm leak increased every time when the above logic was called.&lt;BR /&gt;3) vm leak hit the limit of system vm avaliable.&lt;BR /&gt;4) lib$find_file failed, but the result contains no "*", the program was stuck in the while(1) loop.&lt;BR /&gt;</description>
    <pubDate>Thu, 06 Aug 2009 06:01:40 GMT</pubDate>
    <dc:creator>Kai.Zou</dc:creator>
    <dc:date>2009-08-06T06:01:40Z</dc:date>
    <item>
      <title>Infinite loop problem</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473404#M42639</link>
      <description>Hi, I am newbie here. And I met an Infinite loop problem.&lt;BR /&gt;&lt;BR /&gt;The process paging file quota became critical after activated for 52 days and gave the following messages:&lt;BR /&gt;[Error creating space for command interpreter symbol table&lt;BR /&gt;Process quota exceeded]&lt;BR /&gt;And One more day later, the process was trapped into infinite loop.&lt;BR /&gt;&lt;BR /&gt;I wondered that the reason might be the abuse of lib$find_file ( lack of  lib$find_file_end ).&lt;BR /&gt;Here is my questions:&lt;BR /&gt;1. I knew that lack of lib$find_file_end would cause a memory leak, but would it cause lib$find_file trapped into dead loop?&lt;BR /&gt;2. When infinite dead loop occured, could I use SDA show stack command to determine the dead loop position ( function )? How is the detail way?&lt;BR /&gt;&lt;BR /&gt;thanks very much.&lt;BR /&gt;</description>
      <pubDate>Wed, 05 Aug 2009 04:57:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473404#M42639</guid>
      <dc:creator>Kai.Zou</dc:creator>
      <dc:date>2009-08-05T04:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Infinite loop problem</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473405#M42640</link>
      <description>Kai,&lt;BR /&gt;&lt;BR /&gt;&amp;gt;reason might be the abuse of lib$find_file&lt;BR /&gt;&amp;gt;( lack of lib$find_file_end ).&lt;BR /&gt;&lt;BR /&gt;  That's certainly possible (and a rather advanced diagnosis for a "newbie"! :-). If you don't call lib$find_file_end, you can leak heap space and eventually run out of virtual memory (pagefile quota, frep0va, etc... what you hit depends on quotas).&lt;BR /&gt;&lt;BR /&gt;&amp;gt;[Error creating space for command &lt;BR /&gt;&amp;gt;interpreter symbol table Process quota &lt;BR /&gt;&amp;gt;exceeded]&lt;BR /&gt;&lt;BR /&gt;  This sounds more like a DCL error? Are you running a program, or executing a procedure? Or, maybe SPAWNing a subprocess from a program?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;could I use SDA show stack command to &lt;BR /&gt;&amp;gt;determine the dead loop position&lt;BR /&gt;&lt;BR /&gt;  Yes, basic principle is to sample the PC and correlate it against your image map. See SDA&amp;gt; SHOW IMAGE to get the addresses of various images. Then use your link map to work out which routine it's in from the image offset. Then use your compilation listing to work out the line from the routine offset.&lt;BR /&gt;&lt;BR /&gt;  That said, if this is the result of hitting a memory limit, whatever code is looping is most likely a victim, not culprit, so it's not really helpful to find it. If you know you have cases where LIB$FIND_FILE isn't properly closed off, fix that issue first. When you restart your process, track it's VM usage to make sure it isn't increasing. If it is, try debugging using the heap analyzer.</description>
      <pubDate>Wed, 05 Aug 2009 05:12:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473405#M42640</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2009-08-05T05:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Infinite loop problem</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473406#M42641</link>
      <description>1. I knew that lack of lib$find_file_end would cause a memory leak,but would it cause lib$find_file trapped into dead loop?&lt;BR /&gt;&lt;BR /&gt;You can use SDA and look at the call stack using SHOW CALL/SUMMARY command to figure out whether you are stuck traversing the same calls again and again.&lt;BR /&gt;&lt;BR /&gt;Are you sure you are stuck in a loop ?&lt;BR /&gt;Did you check the status of the process in SDA and figured out?&lt;BR /&gt;Is that process entered some kind of wait state from which it never returns?&lt;BR /&gt;&lt;BR /&gt;I think if you are out of pgflquota or memory lib$ call should have returned an error status. If you think it's a bug please report to HP support.&lt;BR /&gt;&lt;BR /&gt;Some of the commands I generally use to figure out VM usage is&lt;BR /&gt;SDA&amp;gt;sh proc/phd&lt;BR /&gt;$sh proc/cont&lt;BR /&gt;&lt;BR /&gt;2. When infinite dead loop occured, could I use SDA show stack command to determine the dead loop position ( function )? How is the detail way?&lt;BR /&gt;&lt;BR /&gt;I think you should be able to figure using SDA&amp;gt;sh call/summ, it's bit tricky and would require looking at the output multiple time over a period of time.&lt;BR /&gt;&lt;BR /&gt;You can also put some print statements around your code while calling lib$find_file to figure how long it takes to return from that call.&lt;BR /&gt;If it never returns it could be a infinite loop.&lt;BR /&gt;&lt;BR /&gt;You can also use PCS SDA extension ( SDA&amp;gt;PCS gives you the help). SDA&amp;gt;PCS SH TRACE would show you the pc's in a timely manner.&lt;BR /&gt; &lt;BR /&gt;Regards,&lt;BR /&gt;Pramod</description>
      <pubDate>Thu, 06 Aug 2009 04:42:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473406#M42641</guid>
      <dc:creator>Pramod Kumar M</dc:creator>
      <dc:date>2009-08-06T04:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Infinite loop problem</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473407#M42642</link>
      <description>Hi, Dear Pramod,&lt;BR /&gt;The logic of the program I was tracking is like that:&lt;BR /&gt;  while (1) {&lt;BR /&gt;   call lib$find_file ( "*.csv", result buff,&amp;amp;context);&lt;BR /&gt;   if search result buff contains a "*" then&lt;BR /&gt;      return SS$_NORMAL;&lt;BR /&gt;   else&lt;BR /&gt;      rename the search result buff to "*.log"&lt;BR /&gt;   }&lt;BR /&gt;   call lib$find_file_end(&amp;amp;context);&lt;BR /&gt;&lt;BR /&gt;This logic has the following problems:&lt;BR /&gt;1. The while(1) loop only has one existance, when result buff contains a "*" char.&lt;BR /&gt;2. when breaking from the loop, faile to call lib$find_file_end.&lt;BR /&gt;&lt;BR /&gt;Usually, when no files, lib$find_file will return no file return value and the result buff is as same as input searching string(like "*.csv"), the logic seems to be no problem.&lt;BR /&gt;&lt;BR /&gt;So I imagined the situation should be as the following:&lt;BR /&gt;1) lack of lib$find_file_end will cause a vm leak.&lt;BR /&gt;2) the vm leak increased every time when the above logic was called.&lt;BR /&gt;3) vm leak hit the limit of system vm avaliable.&lt;BR /&gt;4) lib$find_file failed, but the result contains no "*", the program was stuck in the while(1) loop.&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Aug 2009 06:01:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473407#M42642</guid>
      <dc:creator>Kai.Zou</dc:creator>
      <dc:date>2009-08-06T06:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Infinite loop problem</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473408#M42643</link>
      <description>Hi, Dear Pramod, &lt;BR /&gt;Thanks very much for your hints.&lt;BR /&gt;&lt;BR /&gt;I had input some printf statement, and wrote a test program, it seemed that the printf statement had affected on the behavir of the program, and the outting log became random every time. But all went down finally because of vm critical.&lt;BR /&gt;&lt;BR /&gt;I considered that the stuck was in the while loop. But no clear evidence. The problem occured recently but the reproduct would take 53 days.&lt;BR /&gt;&lt;BR /&gt;Could u pls tell me, that my analysis had problem or something I missed?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Aug 2009 06:24:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473408#M42643</guid>
      <dc:creator>Kai.Zou</dc:creator>
      <dc:date>2009-08-06T06:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Infinite loop problem</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473409#M42644</link>
      <description>Hi, the stack trace and show call output should be as the following:&lt;BR /&gt;note: the process entry function is dmm_main.&lt;BR /&gt;&lt;BR /&gt;analy/system&lt;BR /&gt;sda&amp;gt; set process dmmprc1&lt;BR /&gt;sda&amp;gt; show stack&lt;BR /&gt;&lt;BR /&gt;Process Stacks (on CPU 00)&lt;BR /&gt;--------------------------&lt;BR /&gt;Current Operating Stack (USER):&lt;BR /&gt;                       00000000.7AEE02E0    00000000.7AEE0318&lt;BR /&gt;                       00000000.7AEE02E8    00000000.0000000F&lt;BR /&gt;                       00000000.7AEE02F0    00000000.00000000&lt;BR /&gt;                       00000000.7AEE02F8    5653432E.00000000&lt;BR /&gt;                SP =&amp;gt;  00000000.7AEE0300    00000000.00018FB0  DMM_MAIN+18FB0 -&amp;gt; stuck point I think&lt;BR /&gt;                       00000000.7AEE0308    7AEE0530.010E270F  DMM_MAIN+010E270F&lt;BR /&gt;                       00000000.7AEE0310    7AEE0330.010E00FF  DMM_MAIN+010E00FF&lt;BR /&gt;                       00000000.7AEE0318    00000000.00000000&lt;BR /&gt;                       00000000.7AEE0320    7AEEAC88.0004A150  DMM_MAIN+4A150&lt;BR /&gt;                       00000000.7AEE0328    00000000.00049E18  DMM_MAIN+49E18&lt;BR /&gt;&lt;BR /&gt;analy/system&lt;BR /&gt;sda&amp;gt; set process dmmprc1&lt;BR /&gt;sda&amp;gt; show call&lt;BR /&gt;sda&amp;gt; show call/next&lt;BR /&gt;DMMã ®callï¼ show call,show call/nextï¼ &lt;BR /&gt;Call Frame Information&lt;BR /&gt;----------------------&lt;BR /&gt;        Stack Frame Procedure Descriptor&lt;BR /&gt;Flags:  Base Register = FP, No Jacket, Native&lt;BR /&gt;        Procedure Entry: 00000000.00186260              DMM_MAIN+00186260&lt;BR /&gt;        Return address on stack = 00000000.0017DCD4       DMM_MAIN+0017DCD4&lt;BR /&gt;&lt;BR /&gt;Registers saved on stack&lt;BR /&gt;------------------------&lt;BR /&gt;7AEE2C48  00000000.000192C0  Saved R2     DMM_MAIN+192C0  &lt;BR /&gt;7AEE2C50  00000000.00000005  Saved R3&lt;BR /&gt;7AEE2C58  00000000.0001863C  Saved R4     DMM_MAIN+1863C&lt;BR /&gt;7AEE2C60  00000000.00000001  Saved R5&lt;BR /&gt;7AEE2C68  00000000.00000000  Saved R6&lt;BR /&gt;7AEE2C70  00000000.00000001  Saved R7&lt;BR /&gt;7AEE2C78  00000000.7AEEAC80  Saved R29&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Aug 2009 06:40:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473409#M42644</guid>
      <dc:creator>Kai.Zou</dc:creator>
      <dc:date>2009-08-06T06:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Infinite loop problem</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473410#M42645</link>
      <description>Kai,&lt;BR /&gt;&lt;BR /&gt;&amp;gt;while (1) {&lt;BR /&gt;&amp;gt; call lib$find_file ( "*.csv", result buff,&amp;amp;context);&lt;BR /&gt;&amp;gt; if search result buff contains a "*" then&lt;BR /&gt;&amp;gt; return SS$_NORMAL;&lt;BR /&gt;&amp;gt; else&lt;BR /&gt;&amp;gt; rename the search result buff to "*.log"&lt;BR /&gt;&amp;gt;}&lt;BR /&gt;&amp;gt; call lib$find_file_end(&amp;amp;context);&lt;BR /&gt;&lt;BR /&gt;  It looks to me like LIB$FIND_FILE_END is unreachable. The only way out of your loop is the conditional return (which skips the LIB$FIND_FILE_END). If LIB$FIND_FILE fails for any reason (like running out of virtual memory) you're in an infinite loop.&lt;BR /&gt;&lt;BR /&gt;  Make sure you add a test of the return status of LIB$FIND_FILE and ensure that LIB$FIND_FILE_END is ALWAYS called when you've finished searching.&lt;BR /&gt;&lt;BR /&gt;  A very simple reformulation might be:&lt;BR /&gt;&lt;BR /&gt;while (lib$find_file ( "*.csv", result buff,&amp;amp;context)){&lt;BR /&gt;  if search result buff contains a "*" then&lt;BR /&gt;    lib$find_file_end(&amp;amp;context);&lt;BR /&gt;    return SS$_NORMAL;&lt;BR /&gt;  else&lt;BR /&gt;    rename the search result buff to "*.log"&lt;BR /&gt;}&lt;BR /&gt;call lib$find_file_end(&amp;amp;context);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I'm assuming this is C - one of the BIG issues I have with C and its brethren is the lack of discipline in control structures.&lt;BR /&gt;&lt;BR /&gt;Too often programmers don't think about what control structures are really doing and cobble together something with "while(1)" and "break", or some monstrosity using the swiss army knife "for loop" abomination. True infinite loops are extremely rare in nature, so seeing one coded should ring alarm bells.&lt;BR /&gt;&lt;BR /&gt;Go back to Dijkstra and learn about loop preconditions, postconditions, predicates, invariants and convergence. Make sure your loops have structural integrity and match the corresponding data structure being processed.</description>
      <pubDate>Thu, 06 Aug 2009 20:30:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473410#M42645</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2009-08-06T20:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Infinite loop problem</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473411#M42646</link>
      <description>Dear John,&lt;BR /&gt;Thanks for your answer very much.&lt;BR /&gt;1. Now, I think, we had agreed with each other about the root cause of the problem, really?&lt;BR /&gt;2. So the problem should be able to be reproduct easily, shouldn't it? But when I tried to reproduct it with a test program, it always fell down, but not infinite loop.&lt;BR /&gt;3. The problem program was not written by me. I am just an analyzer, or maintenancer.&lt;BR /&gt;4. My customer will not agree to modify the issue unless clear evidence of the root cause had been found,now it became a delimmer for me.&lt;BR /&gt;&lt;BR /&gt;So it must be sth. wrong during the analysis or this problem is really caused by a random behaviour?&lt;BR /&gt;&lt;BR /&gt;Any way, thanks again for your sincerely help.&lt;BR /&gt;Thanks so much.</description>
      <pubDate>Fri, 07 Aug 2009 01:18:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/infinite-loop-problem/m-p/4473411#M42646</guid>
      <dc:creator>Kai.Zou</dc:creator>
      <dc:date>2009-08-07T01:18:15Z</dc:date>
    </item>
  </channel>
</rss>

