> On 11/06/2011 08:23 PM, Roberto De Ioris wrote:
>>
>>> On 11/06/2011 07:58 AM, Roberto De Ioris wrote:
>
>>>
>>> --attach-daemon works file.
>>>
>>> I created a small python script spawning one child process.
>>>
>>>
>>> Now I have just problems stopping uwsgi such, that the daemon
>>> ( AND it's child processes are killed)
>>>
>>> uwsgi seems to kill the daemon process as expected, however
>>> the child processes stay alive.
>>>
>>> What I can see is the message:
>>>
>>> SIGINT/SIGQUIT received...killing workers...
>>>
>>> and that my daemon process dies.
>>> The children however won't die
>>>
>>>
>>> I added signals handlers for all possible signals and I don't seem to
>>> receive any.
>>> So I don't know how I could ask the daemon to kill its children at
>>> shutdown.
>>>
>>> Is there any trick?
>>>
>>>
>>
>> attach-daemon create a new process group, so if you call fork() and
>> simply
>> run code the children will be killed too.
>>
>> How do you create children ? If you call setsid(), a new process group
>> will be created so uWSGI will not be able to kill them.
>
>
> I naively used sobprocess.Popen
> # Simplified code snippet
> import subprocess
> log_file = open( 'stdout.log', 'wb')
> err_log_file = open('stderr.log', 'wb')
> cmd = [ 'cmd' , 'param1', 'param2') ]
> proc = subprocess.Popen(cmd, stdout=log_file, stderr=err_log_file)
> proc.wait()
>Looks good. Check with ps if the spawned processes are all under the same process group. Maybe some of your children call setsid()/setpgroup() -- Roberto De Ioris http://unbit.it _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
