- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Call to system() makes the application stuck
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2007 08:51 PM
тАО06-10-2007 08:51 PM
Call to system() makes the application stuck
The OS is HP-UX 11i.
We have a multithreaded application that should call for some bush shell script.
The call to system() makes the application stuck and just reboot helps.
Do you have any idea what makes it stuck?
- Tags:
- system
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2007 08:59 PM
тАО06-10-2007 08:59 PM
Re: Call to system() makes the application stuck
and welcome to the forums !
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 ?
What is the return status of your system() call ?
Please read:
http://66.34.90.71/ITRCForumsEtiquette/after.html
Please also read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33
on how to reward any useful answers given to your questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2007 09:39 PM
тАО06-10-2007 09:39 PM
Re: Call to system() makes the application stuck
The debug statement at the top of the shell script is never printed. We use exit to terminate the shell.
We have alredy an idea regarding the problem: the father thread of the thread that calls to system() blocks SIGCHLD.
We are working on checking if it's the real problem.
Thanks, Yulia
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-10-2007 11:21 PM
тАО06-10-2007 11:21 PM
Re: Call to system() makes the application stuck
We created a sample executable, that creates a thread (see the code below).
The threadEntryFunc just calls to system() to perform an echo command (even not the script mentioned above).
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 .
int main()
{
pthread_attr_t attr;
pthread_t threadId = 0;
int rc;
pid_t pid = getpid();
printf("the pid of the father process is %d\n", pid);
/* create thread */
rc = pthread_attr_init(&attr);
if (rc) {
return rc;
}
rc = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (rc) {
pthread_attr_destroy(&attr);
return rc;
}
rc = pthread_create(&threadId,
&attr,
threadEntryFunc,
(void*)NULL);
if (rc) {
printf("failed to crate thread\n");
pthread_attr_destroy(&attr);
}
printf("after thread function the thread id that was created is %d \n ",
threadId );
return 0;
}
- Tags:
- pthread
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2007 12:44 AM
тАО06-11-2007 12:44 AM
Re: Call to system() makes the application stuck
you may want to read the following thread on output redirect:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1134584
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2007 02:06 AM
тАО06-11-2007 02:06 AM
Re: Call to system() makes the application stuck
It seems that the call never returns.
How do you suggest to use popen() instead of system()?
If yes, it seems it doesn't help.
What do you think the problem is?
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-11-2007 02:58 PM
тАО06-11-2007 02:58 PM
Re: Call to system() makes the application stuck
No need to reboot your system. A kill or kill -9 should clean it up.
>We created a sample executable, that creates a thread (see the code below). The threadEntryFunc just calls to system() to perform an echo command
I have no problems with your sample script, provided I wait until all of the threads are done. I use sleep(10).
>How do you suggest to use popen() instead of system()? If yes, it seems it doesn't help.
This is likely to hang in the exact same way.
>What do you think the problem is?
You need to run tusc to see what exactly is happening.
How many of your threads is trying to execute system(3)? You should really only have one thread calling system(3).