On 03/16/2012 10:53 AM, Nikola Pajkovsky wrote:
Jiri Moskovcak<jmoskovc(a)redhat.com> writes:
> On 03/15/2012 05:26 PM, Nikola Pajkovsky wrote:
>> Denys Vlasenko<dvlasenk(a)redhat.com> writes:
>> + pid_t pid = vfork();
>> + if (pid< 0)
>> + perror_msg_and_die("vfork");
>> + if (pid == 0)
>> + {
>> + xmove_fd(fd, STDIN_FILENO);
>> + execvp(prog[0], prog);
>> + perror_msg_and_die("Can't execute '%s'",
prog[0]);
>> + }
>> +
>> + safe_waitpid(pid, NULL, 0);
>>
>> I think, we should here check returned value from execvp
>> program. Program which SIGSEGV or fails from whatever reason is
>> pointless to run.
>
> - but you need to run it to find out that it doesn't work, so I don't
> understand your proposal - you mean if we detect it failed once then
> disable it and never try to run it again?
try to think what would happen if you have an app with auto start and it
fails to start or do some operation (we have inotify). running it over
and over doesn't bring you anything good. in worst case it could eat
cpu, memory or i/o.
It will start at most once per two seconds. So, yes, it won't be nice,
but not disastrous either.
so if execvp(prog[0], prog) return on pid exit != 0, we should stop
watch-log
Maybe. Maybe not. Maybe we need to make it optional? (--die-on-worker-failure?)
--
vda