Project

General

Profile

Actions

Feature #1765

closed

spawn-fcgi needs "no background" mode

Added by Anonymous over 15 years ago. Updated about 15 years ago.

Status:
Wontfix
Priority:
Normal
Category:
spawn-fcgi
Target version:
ASK QUESTIONS IN Forums:

Description

Right now, you can use -n to get spawn-fcgi to not exit, which is necessary for running services with daemontools. Unfortunately, this keeps -F from working which makes single-threaded servers block on every request. It'd be ideal if there was a way to ask spawn-fcgi to spawn a bunch of child processes and then wait for all of its children to exit.

-- derrick


Files

lighttpd-spawn-fcgi.patch (1.01 KB) lighttpd-spawn-fcgi.patch Patch to make -n and -F play nicely together. -- derrick Anonymous, 2008-09-04 23:02
lighttpd-spawn-fcgi.2.patch (5.99 KB) lighttpd-spawn-fcgi.2.patch Patch to make -n and -F play nicely together. Second try. Now respawns dead processes in -n. -- derrick Anonymous, 2008-09-05 00:57
Actions #1

Updated by stbuehler over 15 years ago

  • Status changed from New to Fixed
  • Resolution set to wontfix

I disagree; if you want many forks to be running, you want to "watch" all of them (waiting till the last one dies before restarting doesn't make sense).

So you just have to use multiple supervice/spawn-fcgi instances. lighttpd has no problem balancing over multiple sockets.

Good fastcgi applications should have their own worker-fork/thread support if they can only on request at a time, so they can share some memory for common settings/caches/...

Actions #2

Updated by Anonymous over 15 years ago

  • Status changed from Fixed to Need Feedback
  • Resolution deleted (wontfix)

This is extremely impractical when working with daemontools, specifically, which is what the -n feature was supposedly added to deal with. It means that you have a bunch of almost-identical-but-not-quite configurations that supervise is dealing with and these all have to match up with the lighttpd configuration.

I could write something to fork a bunch of processes when -n is in effect, but they wouldn't all be on the same socket. Honestly, I think that -F should do what it is advertised to do and when -n is in use, it doesn't.

Actions #3

Updated by stbuehler over 15 years ago

  • Status changed from Need Feedback to Fixed
  • Resolution set to wontfix

Obviously you didn't get the message...

IT DOESN'T MAKE ANY SENSE

Actions #4

Updated by Anonymous over 15 years ago

  • Status changed from Fixed to Need Feedback
  • Resolution deleted (wontfix)

1.) You don't need to be rude.
2.) It does make sense. I am describing a real-world problem.
3.) We don't always have the luxury of controlling the source for the processes we're trying to launch.
4.) The fact is, spawn-fcgi lies about what -F does; namely, it doesn't do what it advertises when -n is used.

According to the provided help, -n is supposed to keep the process from going into the background specifically so that this works with daemontools. -F is supposed to fork multiple processes on the same socket.

-F does not work in the presence of -n because someone made a poor choice.

I don't know how to say it any more simply than that.

Actions #5

Updated by stbuehler over 15 years ago

  • Status changed from Need Feedback to Fixed
  • Resolution set to wontfix

Can you please read again my first post...?

If you want many forks to be running, you want to "watch" all of them (waiting till the last one dies before restarting doesn't make sense)

I don't know how to say that any more simple... perhaps a little bit more complex?

spawn-fcgi doesn't supervise your forks, and doesn't restart them. So if you fork 10 workers and 9 die, you have only one remaining and your supervise wouldn't care. So you completely screwed the idea behind supervise. That is just stupid, and it is therefore a good choice not to support it, even if the help of spawn-fcgi does not indicate that. I myself would just kill the -F option.

If you really don't care about that and want to screw your setup, just use a wrapper script:


#!/bin/bash

TARGET=/your/fcgi/app
N=10
declare -a pids
for((i=0;i<N;i++))
do
    $TARGET &
    pids[$i]=$!
done

for((i=0;i<N;i++))
do
    wait ${pids[$i]}
done

If you want to discuss it further, join us in irc.

But do not again ask us to provide ugly workarounds for your problems. We have enough problems with existing bad code.

Actions #6

Updated by Anonymous over 15 years ago

I'm not asking you to provide a workaround. I'm using the bug tracking system to track a bug. There's the patch. Now both -n and -F do what they say they do.

Actions #7

Updated by Anonymous over 15 years ago

Furthermore, I don't want to watch a bunch of forks. I want to watch the thing that created the socket, which is spawn-fcgi. What if a single thread of a multi-threaded process stops responding properly? In that case, supervise will not help either.

Actions #8

Updated by Anonymous over 15 years ago

  • Status changed from Fixed to Need Feedback
  • Resolution deleted (wontfix)
Actions #9

Updated by stbuehler over 15 years ago

that patch doesn't convince me.

some points (i guess there are more):
- for termination it doesn't wait for the childs to terminate (and it should!)
- it doesn't catch signals and relay them to the childs; the child processes don't just die.

i guess this is a little bit more work than you think, and i will apply a really clean version only. otoh, you could of course just provide your own "spawn-fcgi" version if you think i'm expecting too much :)

Actions #10

Updated by stbuehler over 15 years ago

  • Status changed from Need Feedback to Fixed
  • Resolution set to wontfix

missing feedback.

Actions #11

Updated by stbuehler over 15 years ago

  • Status changed from Fixed to Wontfix
Actions #12

Updated by stbuehler about 15 years ago

  • Pending changed from Yes to No
  • Patch available set to No
Actions

Also available in: Atom