Hi,
I've had a quite mysterious problem for quite a time now..
I have a program that performs calls to underlying resources,
e.g., SQL*Plus. The HW is Sun Fire v440, Sun OS 9.
Everything works perfect when the underlying resources are
available and functional. But when not, the program continues
to fail.
Basically, the parent process reads data from a file that is opened
by freopen. The reason using freopen is to redirect stdout from child
to this file. And it works ok when resources are available.
But it seems that, if the call to the underlying resource fails once, it
keeps on failing. All the time. A workaround is to restart the program,
but even this fails sometimes..
The main problem seems to be that the actual call to the underlying
resource is not performed, whereby no stdout is redirected to the
file, so the files keep on being 0 byte.
The problem always happens upon reboot of a server. If my program
does not wait for the underlying resources, it'll keep on failing.
Here's the (pseudo) code:
So, it works when the resources are OK. But if not ok, it fails once, and keepsCode:while (runForever) { fork if child freopen(file, "w", stdout))) execv (underlying resource); if parent sleep (untilChildShouldBeDone); // Wait if child's call takes a while... kill (theChild); // If child's underlying call hangs, it must be terminated... wait (null); // Avoid the defunct processes.. }
on failing. It seems like the actual execv call just is not performed..
Does anyone have any idea of what might be wrong; how to handle it, or even
how to achieve the same task differently..?
Thanks
Tobias



LinkBack URL
About LinkBacks



