system("mkdir -p /tmp/20051128") never returns
Hi,
I inherited from someone a multithreaded application that issues about 20 or
so system() calls. All similar to:
system("mkdir -p /tmp/20051124");
(Please hold your flames over the usage of system() in multi-threaded
application :-) )
after some time of execution it issues the
system("mkdir -p /tmp/20051128")
which never returns. Could someone recommend a possible theory why it could
happen and suggest a strategy of debugging it?
Note, I have absolutely no problems typing "mkdir -p /tmp/20051128" in a
separate shell window and executing it.
HELP!!!!
Thanx,
Ed Gokhman
Re: system("mkdir -p /tmp/20051128") never returns
On Fri, 25 Nov 2005 19:29:57 -0500, egokhman wrote this:
[color=blue]
> Hi,
>
> I inherited from someone a multithreaded application that issues about 20
> or so system() calls. All similar to:
>
> system("mkdir -p /tmp/20051124");
> (Please hold your flames over the usage of system() in multi-threaded
> application :-) )
> after some time of execution it issues the system("mkdir -p
> /tmp/20051128")
> which never returns. Could someone recommend a possible theory why it
> could happen and suggest a strategy of debugging it?
>
> Note, I have absolutely no problems typing "mkdir -p /tmp/20051128" in a
> separate shell window and executing it.
>
> HELP!!!!
>
> Thanx,
> Ed Gokhman[/color]
Don't know. Is this C/C++, i = system() ? Or Bash try exec() instead?
In either case maybe the command is failing or the return was lost in the
multi-threaded env. Maybe you could move the temp dir allocation to the
start of the application with error messages if the allocation fails.
Re: system("mkdir -p /tmp/20051128") never returns
"egokhman" <egokhman@yahoo.com> writes:[color=blue]
>Hi,
>
>I inherited from someone a multithreaded application that issues about 20 or
>so system() calls. All similar to:
>
>system("mkdir -p /tmp/20051124");
>(Please hold your flames over the usage of system() in multi-threaded
>application :-) )
>after some time of execution it issues the
>system("mkdir -p /tmp/20051128")
>which never returns. Could someone recommend a possible theory why it could
>happen and suggest a strategy of debugging it?[/color]
Don't use system in a multithreaded application and system(3) won't
hang. Internally system(3) is neither thread-safe, nor re-entrant.
scott
Re: system("mkdir -p /tmp/20051128") never returns
Have you tried using strace, it should help you find where the problem
lies? Strace debugs system calls and signals.
--
harryedwards