<?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 Call to system() makes the application stuck in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017017#M96484</link>
    <description>Hi,&lt;BR /&gt;The OS is HP-UX 11i.&lt;BR /&gt;We have a multithreaded application that should call for some bush shell script. &lt;BR /&gt;&lt;BR /&gt;The call to system() makes the application stuck and just reboot helps.&lt;BR /&gt;Do you have any idea what makes it stuck?</description>
    <pubDate>Mon, 11 Jun 2007 03:51:35 GMT</pubDate>
    <dc:creator>Yulia Vilensky</dc:creator>
    <dc:date>2007-06-11T03:51:35Z</dc:date>
    <item>
      <title>Call to system() makes the application stuck</title>
      <link>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017017#M96484</link>
      <description>Hi,&lt;BR /&gt;The OS is HP-UX 11i.&lt;BR /&gt;We have a multithreaded application that should call for some bush shell script. &lt;BR /&gt;&lt;BR /&gt;The call to system() makes the application stuck and just reboot helps.&lt;BR /&gt;Do you have any idea what makes it stuck?</description>
      <pubDate>Mon, 11 Jun 2007 03:51:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017017#M96484</guid>
      <dc:creator>Yulia Vilensky</dc:creator>
      <dc:date>2007-06-11T03:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Call to system() makes the application stuck</title>
      <link>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017018#M96485</link>
      <description>Hi,&lt;BR /&gt;and welcome to the forums !&lt;BR /&gt;&lt;BR /&gt;Is the system call successful. Have you put a debug statment at the top of your external shell script ? Are you using exit to terminate the shell ?&lt;BR /&gt;What is the return status of your system() call ?&lt;BR /&gt;&lt;BR /&gt;Please read:&lt;BR /&gt;&lt;A href="http://66.34.90.71/ITRCForumsEtiquette/after.html" target="_blank"&gt;http://66.34.90.71/ITRCForumsEtiquette/after.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Please also read:&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt;&lt;BR /&gt;on how to reward any useful answers given to your questions.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Jun 2007 03:59:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017018#M96485</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-06-11T03:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Call to system() makes the application stuck</title>
      <link>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017019#M96486</link>
      <description>The system call never returns.&lt;BR /&gt;The debug statement  at the top of the shell script is never printed. We use exit to terminate the shell.&lt;BR /&gt;We have alredy an idea regarding the problem: the father thread of the thread that calls to system() blocks SIGCHLD.&lt;BR /&gt;We are working on checking if it's the real problem.&lt;BR /&gt;Thanks, Yulia</description>
      <pubDate>Mon, 11 Jun 2007 04:39:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017019#M96486</guid>
      <dc:creator>Yulia Vilensky</dc:creator>
      <dc:date>2007-06-11T04:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: Call to system() makes the application stuck</title>
      <link>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017020#M96487</link>
      <description>It seems that the problem isn't in blocking any signals. &lt;BR /&gt;We created a sample executable, that creates a thread (see the code below).&lt;BR /&gt;The threadEntryFunc just calls to system() to perform an echo command (even not the script mentioned above).&lt;BR /&gt;When the executable runs for the first time, we can see prints from  threadEntryFunc , but the system call seems not to be performed. For the second time we don't see even the prints from threadEntryFunc .&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;  pthread_attr_t attr;&lt;BR /&gt;  pthread_t      threadId = 0;&lt;BR /&gt;  int            rc;&lt;BR /&gt;  &lt;BR /&gt;  pid_t pid = getpid();&lt;BR /&gt;  printf("the pid of the father process is %d\n", pid);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;  /* create thread */&lt;BR /&gt;  rc = pthread_attr_init(&amp;amp;attr);&lt;BR /&gt;  if (rc) {&lt;BR /&gt;    return rc;&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;  rc = pthread_attr_setdetachstate(&amp;amp;attr, PTHREAD_CREATE_DETACHED);&lt;BR /&gt;  if (rc) {&lt;BR /&gt;    pthread_attr_destroy(&amp;amp;attr);&lt;BR /&gt;    return rc;&lt;BR /&gt;  } &lt;BR /&gt;&lt;BR /&gt;  rc = pthread_create(&amp;amp;threadId,        &lt;BR /&gt;                      &amp;amp;attr,           &lt;BR /&gt;                      threadEntryFunc, &lt;BR /&gt;                      (void*)NULL);&lt;BR /&gt;&lt;BR /&gt;  if (rc) {&lt;BR /&gt;    printf("failed to crate thread\n");&lt;BR /&gt;    pthread_attr_destroy(&amp;amp;attr);&lt;BR /&gt;  } &lt;BR /&gt;  &lt;BR /&gt;  printf("after thread function the thread id that was created is %d \n ",&lt;BR /&gt;         threadId );&lt;BR /&gt;&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Mon, 11 Jun 2007 06:21:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017020#M96487</guid>
      <dc:creator>Yulia Vilensky</dc:creator>
      <dc:date>2007-06-11T06:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: Call to system() makes the application stuck</title>
      <link>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017021#M96488</link>
      <description>Hi,&lt;BR /&gt;you may want to read the following thread on output redirect:&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1134584" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1134584&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;When you debug the code where does the focus go to ? Does the system attempt to execute the system call but never returns, as it still waiting as to what to do with the output ?</description>
      <pubDate>Mon, 11 Jun 2007 07:44:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017021#M96488</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2007-06-11T07:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Call to system() makes the application stuck</title>
      <link>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017022#M96489</link>
      <description>Hi, &lt;BR /&gt;It seems that the call never returns.&lt;BR /&gt;&lt;BR /&gt;How do you suggest to use popen() instead of system()?&lt;BR /&gt;If yes, it seems it doesn't help.&lt;BR /&gt;&lt;BR /&gt;What do you think the problem is?&lt;BR /&gt;&lt;BR /&gt;I want to admit that there wasn't any problem in calling to system() if no new thread is created, i.e. the application is single-threaded</description>
      <pubDate>Mon, 11 Jun 2007 09:06:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017022#M96489</guid>
      <dc:creator>Yulia Vilensky</dc:creator>
      <dc:date>2007-06-11T09:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: Call to system() makes the application stuck</title>
      <link>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017023#M96490</link>
      <description>&amp;gt;The call to system() makes the application stuck and just reboot helps.&lt;BR /&gt;&lt;BR /&gt;No need to reboot your system.  A kill or kill -9 should clean it up.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;We created a sample executable, that creates a thread (see the code below).  The threadEntryFunc just calls to system() to perform an echo command&lt;BR /&gt;&lt;BR /&gt;I have no problems with your sample script, provided I wait until all of the threads are done.  I use sleep(10).&lt;BR /&gt;&lt;BR /&gt;&amp;gt;How do you suggest to use popen() instead of system()?  If yes, it seems it doesn't help.&lt;BR /&gt;&lt;BR /&gt;This is likely to hang in the exact same way.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;What do you think the problem is?&lt;BR /&gt;&lt;BR /&gt;You need to run tusc to see what exactly is happening.&lt;BR /&gt;&lt;BR /&gt;How many of your threads is trying to execute system(3)?  You should really only have one thread calling system(3).</description>
      <pubDate>Mon, 11 Jun 2007 21:58:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/call-to-system-makes-the-application-stuck/m-p/4017023#M96490</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-06-11T21:58:26Z</dc:date>
    </item>
  </channel>
</rss>

