On Mar 14, 9:28 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2007-03-13 at 08:10 -0700, Ino Pua wrote:
> > Using just 'ls' or something similar does not trigger the bug. You
> > have to start a daemon from django in order to trigger it. The
> > attached views assume cmd to be a command that takes 'start' as a
> > parameter in order to daemonize it, so for freebsd you might have to
> > customize the "    p = subprocess.Popen([cmdname, 'start'],
> > stdout=subprocess.PIPE) " line in order to start your daemon.
>
> I suspect this really a Django problem. It sounds like, despite the
> attempt to daemonize the process, the init script isn't properly
> shutting down or something and so the process that is executing
> mod_python and that particular view hasn't finished yet (it still has a
> child process).

Writing the same service using twisted works just fine, so at the
moment Im using
a really dirty workaround by making an xmlrpc-call to the twisted
server telling it
to execute my command instead. Shutting down/restarting the twisted
server works
without a problem even while starting any amount of services (be it
any in /etc/init.d
or my custom services).

> One way to check this out would be to check out the state
> of /proc/<pid>/fd and the like (it sounds like you're on a Linux system)
> to see if there are file handles to your subprocess command still open.
> Basically, you need to investigate at the sytsem level and work out why
> the python function does think its work is done yet. There is nothing
> really Django specific going on here that I can see, but deeper
> investigation may prove otherwise.

Judging from /proc/pid/fd everything is as I would assume it was: just
a config file,
a log file and three sockets open (in my case, the program listens on
three ports), And
three references (Im assuming stdin, stdout, stderr) to /dev/null.
Same with any other
daemon I've looked at. Since it works ok from the command line or from
a twisted
service, I can only assume its not where the problem lies.


UPDATE:

Ive tried getting it to work with mod_python, but all kinds of
permission issues and
environment issues came biting me when I did, so Ive decided to stick
with the
xmlrpc-server solution for the time being.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to