rkmr.em@gmail.com | 11 Dec 02:21

spawn-fcgi problem

hi,
if i spawn an fcgi processes using spawn-fcgi, and exit the terminal it does not close till the spawned fcgi process dies or is killed in opensolaris...
 how do i fix this?
Amanda Waite | 14 Dec 17:46

Re: spawn-fcgi problem

I'm not able to recreate this. I have a Rails CRUD app installed at /export/home/regapp on OpenSolaris. if I run spawn-fcgi like this

spawn-fcgi -f /export/home/regapp/public/dispatch.fcgi -s /tmp/regapp.fcgi.socket-1 -u nobody -g nogroup

(where nobody/nogroup is the user/group I'm running Lighttpd under)

The spawn-fcgi app forks a new fcgi process and then exits. I can then do what I want in the terminal, including closing it.

I'm probably not understanding the question correctly, or my setup is fundamentally different to yours.

This was with Lighttpd 1.4.18

Mandy

On 11/12/2007, rkmr.em <at> gmail.com <rkmr.em <at> gmail.com> wrote:
hi,
if i spawn an fcgi processes using spawn-fcgi, and exit the terminal it does not close till the spawned fcgi process dies or is killed in opensolaris...
 how do i fix this?

rkmr.em@gmail.com | 15 Dec 05:12

Re: spawn-fcgi problem

hi amanda,
can you try to spawn a tcp fastcgi process...

this is what I do, and even after i type in logout it is doesnt exit.. just stays like that

$ /opt/local/bin/spawn-fcgi -f /home/mark/work/groupcards/code.py -p 3222 -P /tmp/1.pid
spawn-fcgi.c.186: child spawned successfully: PID: 186
$ logout


On Dec 14, 2007 8:46 AM, Amanda Waite <mandy.waite2007 <at> googlemail.com > wrote:
I'm not able to recreate this. I have a Rails CRUD app installed at /export/home/regapp on OpenSolaris. if I run spawn-fcgi like this

spawn-fcgi -f /export/home/regapp/public/dispatch.fcgi -s /tmp/regapp.fcgi.socket-1 -u nobody -g nogroup

(where nobody/nogroup is the user/group I'm running Lighttpd under)

The spawn-fcgi app forks a new fcgi process and then exits. I can then do what I want in the terminal, including closing it.

I'm probably not understanding the question correctly, or my setup is fundamentally different to yours.

This was with Lighttpd 1.4.18

Mandy


On 11/12/2007, rkmr.em <at> gmail.com <rkmr.em <at> gmail.com> wrote:
hi,
if i spawn an fcgi processes using spawn-fcgi, and exit the terminal it does not close till the spawned fcgi process dies or is killed in opensolaris...
 how do i fix this?


Amanda Waite | 16 Dec 21:59

Re: spawn-fcgi problem

I tried as you suggested.

spawn-fcgi -f /export/home/regapp/public/dispatch.fcgi -p 7001 -P /tmp/1.pid

And ran this from a terminal under gnome, from the command line console and from a remote shell both as root and as a non-privileged user but I couldn't reproduce the problem (I checked that the app was working during each of the tests)

What versions of OpenSolaris and Lighty are you running?

Before you logout, run ps -ef and see what the Parent Pid (PPID) of the fcgi process is. It should be '1'. Also run the command 'jobs' in the shell to see if there are any jobs running in the background.

Cheers

Mandy


On 15/12/2007, rkmr.em <at> gmail.com <rkmr.em <at> gmail.com > wrote:
hi amanda,
can you try to spawn a tcp fastcgi process...

this is what I do, and even after i type in logout it is doesnt exit.. just stays like that

$ /opt/local/bin/spawn-fcgi -f /home/mark/work/groupcards/code.py -p 3222 -P /tmp/1.pid
spawn-fcgi.c.186: child spawned successfully: PID: 186
$ logout



On Dec 14, 2007 8:46 AM, Amanda Waite < mandy.waite2007 <at> googlemail.com > wrote:
I'm not able to recreate this. I have a Rails CRUD app installed at /export/home/regapp on OpenSolaris. if I run spawn-fcgi like this

spawn-fcgi -f /export/home/regapp/public/dispatch.fcgi -s /tmp/regapp.fcgi.socket-1 -u nobody -g nogroup

(where nobody/nogroup is the user/group I'm running Lighttpd under)

The spawn-fcgi app forks a new fcgi process and then exits. I can then do what I want in the terminal, including closing it.

I'm probably not understanding the question correctly, or my setup is fundamentally different to yours.

This was with Lighttpd 1.4.18

Mandy


On 11/12/2007, rkmr.em <at> gmail.com < rkmr.em <at> gmail.com> wrote:
hi,
if i spawn an fcgi processes using spawn-fcgi, and exit the terminal it does not close till the spawned fcgi process dies or is killed in opensolaris...
 how do i fix this?



Geoff Adams | 17 Dec 19:56

Re: spawn-fcgi problem

On Dec 16, 2007, at 3:59 PM, Amanda Waite wrote:

> Before you logout, run ps -ef and see what the Parent Pid (PPID) of  
> the fcgi process is. It should be '1'. Also run the command 'jobs'  
> in the shell to see if there are any jobs running in the background.

I'm not really sure what's going on in this particular case, but this  
could be some strange interaction between several things, including  
your shell and the method you use to log in (ssh, new xterm window,  
etc.). I've seen a somewhat similar behavior with other, unrelated  
programs on other OSes, but always when using ssh to log in. This may  
point to controlling terminal issues (which proper daemonizing is  
supposed to take care of, but...).

So, perhaps send us the output of that 'ps -ef' command, preferably  
filtered using something like this:

   ps -ef | grep fcgi

and maybe someone will have some ideas. With any luck, you won't see a  
controlling terminal listed. A simple 'ps -af' might also be  
informative. If there's anything there other than the ps command,  
itself, something is probably amiss.

- Geoff

rkmr.em@gmail.com | 17 Dec 21:27

Re: spawn-fcgi problem

Amanda solved this:

Try redirecting standard in and standard error of your spawn-fcgi process like this:

/opt/local/bin/spawn-fcgi -p 3333 -f /home/ask/work/animmes/code.py -P /tmp/a.pid > /tmp/log.out 2>&1

this worked

On Dec 17, 2007 10:56 AM, Geoff Adams <gadams+lighttpd <at> avernus.com> wrote:

On Dec 16, 2007, at 3:59 PM, Amanda Waite wrote:

> Before you logout, run ps -ef and see what the Parent Pid (PPID) of
> the fcgi process is. It should be '1'. Also run the command 'jobs'
> in the shell to see if there are any jobs running in the background.

I'm not really sure what's going on in this particular case, but this
could be some strange interaction between several things, including
your shell and the method you use to log in (ssh, new xterm window,
etc.). I've seen a somewhat similar behavior with other, unrelated
programs on other OSes, but always when using ssh to log in. This may
point to controlling terminal issues (which proper daemonizing is
supposed to take care of, but...).

So, perhaps send us the output of that 'ps -ef' command, preferably
filtered using something like this:

  ps -ef | grep fcgi

and maybe someone will have some ideas. With any luck, you won't see a
controlling terminal listed. A simple 'ps -af' might also be
informative. If there's anything there other than the ps command,
itself, something is probably amiss.

- Geoff

Christian Hoffmann | 18 Dec 13:38

Re: spawn-fcgi problem

On 2007-12-15 05:12, rkmr.em <at> gmail.com wrote:
> hi amanda,
> can you try to spawn a tcp fastcgi process...
> 
> this is what I do, and even after i type in logout it is doesnt exit..
> just stays like that
> 
> $ /opt/local/bin/spawn-fcgi -f /home/mark/work/groupcards/code.py -p
> 3222 -P /tmp/1.pid
> spawn-fcgi.c.186: child spawned successfully: PID: 186
> $ logout
I think it's mostly an sshd bug which got fixed in openssh-4.7. It
affected all background processes which did not completely detach from
the controlling terminal. So it will probably only occur when lighttpd
does not properly detach (did you check you are running the latest
version?) AND your sshd is not fixed regarding that bug.

--

-- 
Christian Hoffmann

Amanda Waite | 18 Dec 19:13

Re: spawn-fcgi problem

Thanks for the heads up on it being fixed in openssh-4.7. This particular issue was seen on OpenSolaris and it's seemingly not been fixed yet. I'll see if I can locate an open ticket for it, if not I'll log one. At least there are several workarounds.

Mandy

On 18/12/2007, Christian Hoffmann < christian <at> hoffie.info> wrote:
On 2007-12-15 05:12, rkmr.em <at> gmail.com wrote:
> hi amanda,
> can you try to spawn a tcp fastcgi process...
>
> this is what I do, and even after i type in logout it is doesnt exit..
> just stays like that
>
> $ /opt/local/bin/spawn-fcgi -f /home/mark/work/groupcards/code.py -p
> 3222 -P /tmp/1.pid
> spawn-fcgi.c.186: child spawned successfully: PID: 186
> $ logout
I think it's mostly an sshd bug which got fixed in openssh-4.7. It
affected all background processes which did not completely detach from
the controlling terminal. So it will probably only occur when lighttpd
does not properly detach (did you check you are running the latest
version?) AND your sshd is not fixed regarding that bug.

--
Christian Hoffmann




Gmane