Hi Ales,

Thanks for your quick answer!

About 1 and 2, I'll try out your supervisor-wildcards plugin real soon -
seems promising - thanks for that.

About 3, sure, I reproduced the problem with a very small PHP snippet (I
don't know if attachments are allowed?):

<code>

<?php
// Needed for signal handling
declare(ticks = 1);

function handle_signals($sig_number)
{
switch ($sig_number)
{
case SIGTERM:
echo "SIGTERM!\n";
exit();
}
}

// Register a function for the TERM signal
pcntl_signal(SIGTERM, 'handle_signals');

// Do nothing forever (until SIGTERM arrives)
while (1)
{
sleep(1);
}

</code>


Executing it:

root@dev workers # php test.php &
[1] 18947
root@dev workers # kill 18947
SIGTERM!
root@dev workers #
[1]+  Done                    php test.php
root@dev workers #


This shows that the SIGTERM signal is getting through fine with regular
execution.

With this supervisor config (below), however, I can't see the "SIGTERM!"
output in the log specified in the config when I stop the processes via
supervisorctl stop s3_upload:* . I did check that the log works. Moreover,
if I look at the PID of one of the processes that was started with
supervisord, and then send a SIGTERM to it, the log shows "SIGTERM!" output!

Supervisor config:
[program:s3_upload]
command=php workers/test.php
;command=php worker.php --name S3Upload --function s3_upload
process_name=%(program_name)s_%(process_num)02d
numprocs=5
directory=/usr/local/bin/gearman-workers
autorestart=true
stopsignal=TERM
startsecs=0
redirect_stderr=true
stdout_logfile=/var/log/gearman-workers/%(program_name)s/%(program_name)s.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10


Thanks!

On Wed, Feb 22, 2012 at 7:58 PM, Ales Zoulek <[email protected]> wrote:

> There are 3 major problems:
>
>> 1. It works, but starting takes a lot of time (starts one by one as I can
>> see in 'ps' output) unless I specify startsecs=0 (but then the processes
>> are not checked if they live >startsecs seconds). I thought that it would
>> run all the processes in parallel somehow, and see if they live more than 1
>> seconds (each one).
>>
>>
>>
> 2. The weirder and more annoying thing is that when stopping
>> (supervisorctl stop worker_name:*), supervisor stops each process one by
>> one, and it takes 1 second for each process. For 30 processes, it's 30
>> seconds until all this 'program' section is stopped.
>>
>>
> Both of those address my supervisor-wildcards plugin:
>
> See installation there:
>  http://pypi.python.org/pypi/supervisor-wildcards/
>
> And just "mstart *" or "mstart *"
>
>
>
>
>
>> 3. When stopping, supervisor is not sending the TERM signal! I think it
>> just kills the process, even though when I do 'kill PID_OF_PROCESS' in a
>> shell, I can see in the logs that the process has caught that signal and
>> exited. That's the worst part of my problem....
>>
>> That's really odd.. Can you give some minimal example somewhere?
>
>
>
>
>> Any help would be much appreciated!
>>
>> Thanks in advance,
>> Bar.
>>
>>
> Regards,
>
> Ales
>
>
>> _______________________________________________
>> Supervisor-users mailing list
>> [email protected]
>> http://lists.supervisord.org/mailman/listinfo/supervisor-users
>>
>>
>
_______________________________________________
Supervisor-users mailing list
[email protected]
http://lists.supervisord.org/mailman/listinfo/supervisor-users

Reply via email to