Proposition:

I have made a small proposed patch to newcron.py, in order to keep a list
of cron subprocesses and send a terminate signal when web2py exists. See
attached newcron.py.diff. A lock should be added when accessing the
_cron_subprocs list, to avoid thread concurrency.

Also, I noticed that newcron.stopcron() is called when closing the widget
window if the web server was started. But if the web server was not
started, it will not be called, which is strange, as cron is started before
the web server. The second attached patch (widget.py.diff) fixes this to
call newcron.stopcron() on exit.

I guess same fix should be applied for winservice.py, and similar for the
--nogui case.

What do you think about this proposed changes?

Thanks.



On Tue, Mar 5, 2013 at 10:23 PM, Álvaro José Iradier <airad...@gmail.com>wrote:

> Hi,
>
> on my web2py application on windows, I have a cron task that runs for a
> long time. I noticed a new process is spawned for every cron job.. If the
> main web2py process exists (for example if I try to terminate the process,
> or close the web2py window), it will not exit until the cron process is
> finished (is it waiting for the child processes to finish?). Am I right, or
> do I get something wrong?
>
> So my question is, Is there a way to detect from the cron process that the
> main web2py process is exiting, in order to finish inmediately, but clean?
> I thought of using the getppid() from the cron process for getting the
> parent process id, but it is not available on windows. Could the main
> web2py process send a "terminate" or "interrupt" signal or similar to the
> still running cron processes? This way the process would be killed, or
> could trap the signal and exit cleanly.
>
> Thanks very much.
>
>
>
>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/NzETk-m6Liw/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
(:=================================:)
 Alvaro J. Iradier Muro - airad...@gmail.com

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Attachment: newcron.py.diff
Description: Binary data

Attachment: widget.py.diff
Description: Binary data

Reply via email to