Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 149467 - www-servers/lighttpd: new init script for spawn-fcgi
Summary: www-servers/lighttpd: new init script for spawn-fcgi
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement with 5 votes (vote)
Assignee: www-servers Herd (OBSOLETE)
URL: http://www.lighttpd.net
Whiteboard:
Keywords:
Depends on:
Blocks: 264840
  Show dependency tree
 
Reported: 2006-09-28 17:40 UTC by James Le Cuirot
Modified: 2009-04-08 14:25 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
spawn-fcgi init script (spawn-fcgi,2.36 KB, text/plain)
2006-09-28 17:40 UTC, James Le Cuirot
Details
spawn-fcgi conf file (spawn-fcgi.conf,1.70 KB, text/plain)
2006-09-28 17:41 UTC, James Le Cuirot
Details
spawn-fcgi init script (spawn-fcgi,2.44 KB, text/plain)
2006-09-28 17:46 UTC, James Le Cuirot
Details
spawn-fcgi conf file (spawn-fcgi,1.87 KB, text/plain)
2008-06-25 14:34 UTC, James Le Cuirot
Details
spawn-fcgi init script (spawn-fcgi,2.29 KB, text/plain)
2008-06-25 14:35 UTC, James Le Cuirot
Details
spawn-fcgi init script (spawn-fcgi,2.29 KB, text/plain)
2008-06-25 16:50 UTC, James Le Cuirot
Details
New init.d script with the abovementioned fixes (spawn-fcgi,2.29 KB, text/plain)
2008-06-25 17:21 UTC, Dennis Schridde
Details
spawn-fcgi init script (spawn-fcgi,2.29 KB, text/plain)
2008-06-25 17:37 UTC, James Le Cuirot
Details
patch to the old spawn-fcgi (old.spawn.git.diff,389 bytes, patch)
2008-11-14 00:15 UTC, Peter Buxton
Details | Diff
Patch to add check whether both of FCGI_PORT and FCGI_SOCKET are defined (spawn-fcgi.check-socket-or-port.patch,452 bytes, patch)
2009-03-02 01:42 UTC, Elias Probst
Details | Diff
Patch to add check whether both of FCGI_PORT and FCGI_SOCKET are defined (spawn-fcgi.check-socket-or-port.patch,419 bytes, patch)
2009-03-02 01:48 UTC, Elias Probst
Details | Diff
debug log when starting spawn-fcgi using /usr/bin/php-cgi as FCGI_PROGRAM (php_debug_output.txt,43.85 KB, text/plain)
2009-04-03 10:54 UTC, Gary Richards
Details
Main process strace information (spawn-fcgi.32018,24.70 KB, text/plain)
2009-04-04 11:45 UTC, Gary Richards
Details
strace output from one of the children (spawn-fcgi.32019,247 bytes, text/plain)
2009-04-04 11:46 UTC, Gary Richards
Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Le Cuirot gentoo-dev 2006-09-28 17:40:08 UTC
The current spawn-fcgi init script isn't very flexible. It only allows you to run one FastCGI application. It is quite likely that people would like to run more than one. I personally run PHP, Rails and Trac all from the same machine. I have written a new init script and config file that allows you to run several FastCGI applications by symlinking. It works in a similar way to the net.* scripts except that the configuration files are separate. For example, for Trac, you would symlink from /etc/init.d/spawn-fcgi to /etc/init.d/fcgi.trac and you would copy the /etc/conf.d/spawn-fcgi configuration file to /etc/conf.d/fcgi.trac. Simple. (-: The user is prevented from starting /etc/init.d/spawn-fcgi directly.

Please also see bug #149465.
Comment 1 James Le Cuirot gentoo-dev 2006-09-28 17:40:42 UTC
Created attachment 98347 [details]
spawn-fcgi init script
Comment 2 James Le Cuirot gentoo-dev 2006-09-28 17:41:02 UTC
Created attachment 98348 [details]
spawn-fcgi conf file
Comment 3 James Le Cuirot gentoo-dev 2006-09-28 17:46:45 UTC
Created attachment 98349 [details]
spawn-fcgi init script

Oops. Last minute fixes!
Comment 4 Jakub Moc (RETIRED) gentoo-dev 2006-10-25 12:00:56 UTC
# Thilo Bangert <bangert@gentoo.org> (30 Sep 2006)
# packages have been absorbed by lighttpd - pending removal (30 Oct), bug 149599
net-www/spawn-fcgi
dev-libs/localizer

Will be removed from portage -> WONTFIX.
Comment 5 James Le Cuirot gentoo-dev 2006-10-25 12:49:57 UTC
I'm fairly certain the spawn-fcgi executable is not being removed from the lighttpd package. It isn't strictly needed in order to run FastCGI applications but it is if you want to be able to start/stop your applications independently of the web server. These scripts are still very relevant to the lighttpd package. I'm giving you something useful here, please don't throw it back in my face.
Comment 6 James Le Cuirot gentoo-dev 2006-12-06 18:26:33 UTC
As I expected, spawn-fcgi is still being installed as part of lighttpd. Please reconsider these scripts.
Comment 7 Renat Lumpau (RETIRED) gentoo-dev 2007-01-02 16:27:15 UTC
has been removed
Comment 8 James Le Cuirot gentoo-dev 2007-01-03 02:15:33 UTC
WILL SOMEONE PLEASE READ WHAT I AM WRITING!! spawn-fcgi is included AS PART OF LIGHTTPD. Check it for yourself. Run "ls /usr/bin/spawn-fcgi". Check the lighttpd ebuild. Just stop ignoring me.
Comment 9 Renat Lumpau (RETIRED) gentoo-dev 2007-01-03 07:48:58 UTC
reassigning to hopefully the right people
Comment 10 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2007-01-03 08:50:07 UTC
hhm, i have not looked at the script - but it sounds indeed usefull. 

i don't know what the spawn-fcgi init.d script starts now, but i don't like the idea of adding something which breaks existing setup's...

do you think it would be possible to modify your startup script in a way that it keeps current setups running and only add's this extra functionality if it is wanted? (again, i haven't looked at the script yet - sorry)

thanks
Comment 11 James Le Cuirot gentoo-dev 2007-01-03 09:12:22 UTC
Phew. (-:

Hmmm. It might be possible but it would be very awkward and confusing because the new script works in a very different way. It's not supposed to be run directly. By default, the old script starts PHP. A nicer solution would be to include a small function in the ebuild or elsewhere that would convert an existing config file to the new format and rename any spawn-fcgi symlinks in /etc/runlevel.
Comment 12 Elfyn McBratney (beu) (RETIRED) gentoo-dev 2007-01-04 17:20:35 UTC
Hmm, migrating to this new script will be tricky.  I'm planning on moving away from our own set of configs and moving to what upstream uses (rather what they will soon be using), so I'd prefer to kill these two birds with just the one stone.

Regardless, I'm working on this - thanks muchly for the bug and the improved scripts!
Comment 13 Thomas Seifert 2007-07-20 19:11:01 UTC
Has there been any progress made in this?
I'm running different php-versions as fcgi and would therefore prefer to use the "portage-way" of maintaining the spawn-fcgi scripts.
Comment 14 James Le Cuirot gentoo-dev 2007-07-20 19:38:14 UTC
I still stand by my scripts. I haven't seen any progress with what beu was talking about. I think he's left Gentoo actually.
Comment 15 Fabio Coatti 2007-08-12 14:40:54 UTC
Don't know if this is the right place, but a remark: on my setup, it seems that the init script for spawn-fcgi has a problem: the php-cgi process spawned remains tied to pid file. So it puts all the statistics in pid file and at "stop" you can imagine the mess.

I'm using spawn-fcgi with nginx, but this seems nor related to this.

maybe thr problem lies here?
        env - ${E} ${EX} 2>${SPAWNFCGI_PID}

Comment 16 James Le Cuirot gentoo-dev 2007-08-12 14:57:44 UTC
You are referring to the current scripts, not my new ones. I understand what you're saying though. Perhaps another reason to give my scripts a try?
Comment 17 Fabio Coatti 2007-08-12 17:49:04 UTC
(In reply to comment #16)
> You are referring to the current scripts, not my new ones. I understand what
> you're saying though. Perhaps another reason to give my scripts a try?
> 

Yes, indeed. With your script all works just fine; with the old one my box always get stuck on shutdown, forcing a reset leading do a unwanted fsck.
I use it to fire up both php-cgi and a script that takes care of perl cgi handling (something found on internet, wandering if there is something packaged :) )

I strongly suggest to adopt your script, my only advice is to change (as I did on my box) the variables according to the script now bundled with gentoo ebuild, so it's possible to replace the actual one seamlessly, without having to make changes on configuration script.

Actually, I'm thinking to make a custom ebuild able to install only spawn-fcgi script and possibly the init script: I'm using nginx and not lighttp and now I've to keep lighty installed just for spawn-fcgi. Maybe this will be useful to anyone using nginx...
Comment 18 Thomas Seifert 2007-09-22 11:17:48 UTC
(In reply to comment #15)
> ... it seems that
> the init script for spawn-fcgi has a problem: the php-cgi process spawned
> remains tied to pid file. So it puts all the statistics in pid file and at
> "stop" you can imagine the mess. ...

This problem is driving me nuts too.
Could, please, some dev look into it or even better finish and include the init-scripts from this bug-report?

thanks a lot.
Comment 19 teedog 2007-12-07 19:41:54 UTC
I am, in fact, disappointed to find that www-servers/spawn-fcgi was removed (bug 149599).  www-servers/spawn-fcgi might have been added to support Lighttpd initially, but there are many other web servers that don't have built-in tools to spawn FastCGI daemons.  These web servers, like NginX, would benefit greatly from a stand-alone www-servers/spawn-fcgi package.  It should not be depended upon by any package, but simply be available as a generic FastCGI spawner for use with any web server.

Googling about using PHP and NginX yields a lot of custom-hacked init scripts for launching php-fastcgi (none specific to Gentoo that I could find) and instructions for "borrowing" Lighttpd's spawn-fcgi.

If www-servers/spawn-fcgi is re-added as a stand-alone tool, that would be a good chance to look into James's improved init script as well.
Comment 20 Thomas Seifert 2007-12-21 16:38:47 UTC
I totally agree. Currently I have lighttpd installed just for not having to manually install/configure spawn-fcgi.
Comment 21 gentoo 2008-06-25 13:46:23 UTC
Do you think you could add the fix in your script, so it DOESN'T ignore the FCGI_WEB_SERVER_ADDRS from the config files?

See my initial bug report and quick fix in http://bugs.gentoo.org/show_bug.cgi?id=215247
Comment 22 gentoo 2008-06-25 13:56:46 UTC
Also consider adding chroot support:
http://bugs.gentoo.org/show_bug.cgi?id=223233
Comment 23 James Le Cuirot gentoo-dev 2008-06-25 14:34:38 UTC
Created attachment 158397 [details]
spawn-fcgi conf file
Comment 24 James Le Cuirot gentoo-dev 2008-06-25 14:35:15 UTC
Created attachment 158401 [details]
spawn-fcgi init script
Comment 25 James Le Cuirot gentoo-dev 2008-06-25 14:44:07 UTC
Here is an update.

It includes a fix that prevented "stop" from working on OpenRC systems. I'm not sure whether the RC_SVCNAME variable is set on pre-OpenRC systems. Hopefully it is!

I have changed FCGI_WEB_SERVER_ADDRS to FCGI_ADDRESS and it actually works now. I thought this variable was just picked up automatically by spawn-fcgi but now I realise it's not. It's important to note that only one IP can actually be specified. I checked the source code to verify this.

I have also added an FCGI_CHROOT option.

Another interesting point to mention is that when starting spawn-fcgi with the -u (user) option, that user's additional groups do not take effect. I think spawn-fcgi would have to be modified for this to work. An easy workaround is to launch it through sudo instead. I could do this by default if sudo is available but unusual sudo configurations would break it.
Comment 26 Dennis Schridde 2008-06-25 16:47:00 UTC
Exchange RC_SVCNAME with SVCNAME and it will work.

Besides of that it seems to work well.
Comment 27 Dennis Schridde 2008-06-25 16:48:23 UTC
Even better, this also seems to have fixed some weird "unexpected end-of-file" error in the interaction of lighttpd <-> trac.
Comment 28 James Le Cuirot gentoo-dev 2008-06-25 16:50:30 UTC
Created attachment 158413 [details]
spawn-fcgi init script

Done.
Comment 29 Dennis Schridde 2008-06-25 17:21:21 UTC
Created attachment 158415 [details]
New init.d script with the abovementioned fixes

Fixed the init.d script:
- RC_SVCNAME -> SVCNAME
- Made the shutdown process work by killing in a loop, instead of killing concated pids (123 + 456 -> 123456 -> no such process)
- Also let a failed shutdown (namely the kill command) spit out an error message, since otherwise it might be hard to debug (no syslog messages, i.e.)
Comment 30 James Le Cuirot gentoo-dev 2008-06-25 17:34:46 UTC
Actually I killed them in a loop before but couldn't think why I'd done it like that. Now I realise why. Line breaks act as separators but spawn-fcgi doesn't add a line break like all the other PID files on my system. Sorry!
Comment 31 James Le Cuirot gentoo-dev 2008-06-25 17:37:08 UTC
Created attachment 158417 [details]
spawn-fcgi init script

You missed an instance of RC_SVCNAME.
Comment 32 Peter Buxton 2008-11-14 00:15:24 UTC
Created attachment 171677 [details, diff]
patch to the old spawn-fcgi

I think the maintainer makes a good point about using the upstream methods, but a general purpose FCGI spawner does sound very useful.

However, as long as we're using the old Gentoo spawn-fcgi, please apply the above diff. It actually captures the php-cgi PID for stopping and restarting the service.

-p
Comment 33 James Pic 2008-11-15 01:42:14 UTC
Maybe the name of new script be changed to /etc/init.d/gentoo-spawn-fcgi etc ...
And then this could finally get in! I ignore if any Gentoo dev. is actually running multiple fastcgi websites with the current scripts without heavy hacking (which could be agilely factorized): if so then maybe we could know more about it? Else we need this feature in; without BC break of course please :)
Thanks for sharing the script. Cheers.
Comment 34 James Le Cuirot gentoo-dev 2008-11-15 10:26:50 UTC
I'd be pushing for this more if it weren't for the fact that most of my servers run Ubuntu. XD Not really my choice though.
Comment 35 James Pic 2008-11-15 11:19:12 UTC
Please fix the BC break to make it acceptable into Gentoo.
Thanks again for the scripts! Cheers.
Comment 36 Elias Probst 2009-02-26 09:09:20 UTC
I'd really love to see:
- The spawn-fcgi functionality being removed from net-www/lighttpd
- The spawn-fcgi ebuild re-added to the portage tree
- The spawn-fcgi making use of this improved script
- Having 'fastcgi? ( net-www/spawn-fcgi )' in net-www/lighttpd, net-www/nginx,...

I'm running nginx here and this just feels really strange having lighttpd installed only to provide the spawn-fcgi bin which seems to be split from lighttpd now anyways: http://redmine.lighttpd.net/projects/spawn-fcgi
Comment 37 James Le Cuirot gentoo-dev 2009-02-26 10:30:30 UTC
I'm now using nginx as well so I have the same issue.
Comment 38 Elias Probst 2009-03-02 01:42:05 UTC
Created attachment 183637 [details, diff]
Patch to add check whether both of FCGI_PORT and FCGI_SOCKET are defined

This patch adds a check whether both of FCGI_PORT and FCGI_SOCKET are defined.
Until now the script just failed silently and only "--debug" showed the actual issue.
Now the script checks for this before.
Comment 39 Elias Probst 2009-03-02 01:48:03 UTC
Created attachment 183638 [details, diff]
Patch to add check whether both of FCGI_PORT and FCGI_SOCKET are defined

My previous patch checked for FCGI_ADDRESS ... don't ask me why ;-)

This one does now correctly by checking for FCGI_PORT and FCGI_SOCKET
Comment 40 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2009-04-01 09:15:59 UTC
Comment on attachment 171677 [details, diff]
patch to the old spawn-fcgi

this patch is a dupe of #252268 - please only open separate bugs for seperate bugs ;-)
Comment 41 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2009-04-01 10:16:41 UTC
www-servers/spawn-fcgi is now in portage using this script - please test.
thanks for your contribution and perseverance.

feedback welcome!

kind regards
Thilo
Comment 42 Gary Richards 2009-04-02 14:04:27 UTC
Is this supposed to work with php-cgi? If so how?

I copied /etc/conf.d/spawn-fcgi /etc/conf.d/spawn-fcgi.test and set:
FCGI_PROGRAM=/usr/bin/php-cgi
In spawn-fcgi.test

I symlinked /etc/init.d/spawn-fcgi to /etc/init.d/spawn-fgi.test

And yet when I try to start it I get:

 # /etc/init.d/spawn-fcgi.test start
 * Starting FastCGI application test ...
spawn-fcgi: child spawned successfully: PID: 10595        [ !! ]

I end up with no php-cgi processes running.

If I mod the init script slightly to echo the start-stop-daemon line and then manually paste that into my shell, everything starts up fine. Which is odd, because it's clearly not working from within the init script.

Any suggestions?
Comment 43 thomasg 2009-04-02 15:38:26 UTC
(In reply to comment #42)
> Is this supposed to work with php-cgi? If so how?
> 
> I copied /etc/conf.d/spawn-fcgi /etc/conf.d/spawn-fcgi.test and set:
> FCGI_PROGRAM=/usr/bin/php-cgi
> In spawn-fcgi.test
> 
> I symlinked /etc/init.d/spawn-fcgi to /etc/init.d/spawn-fgi.test
> 
> And yet when I try to start it I get:
> 
>  # /etc/init.d/spawn-fcgi.test start
>  * Starting FastCGI application test ...
> spawn-fcgi: child spawned successfully: PID: 10595        [ !! ]
> 
> I end up with no php-cgi processes running.
> 
> If I mod the init script slightly to echo the start-stop-daemon line and then
> manually paste that into my shell, everything starts up fine. Which is odd,
> because it's clearly not working from within the init script.
> 
> Any suggestions?
> 

I can confirm this. The script spawns the process, gets a PID and immediately kills this pid (= fails).
If it helps, I can post the relevant --debug output of the script.
Comment 44 Elias Probst 2009-04-02 16:23:30 UTC
(In reply to comment #43)
> I can confirm this. The script spawns the process, gets a PID and immediately
> kills this pid (= fails).
> If it helps, I can post the relevant --debug output of the script.

I had this troubles too - that's because the script does nearly no error checking at all and some arguments are incompatible.

I did a rewrite of the script which still needs some polishing, but I'll post this rewrite here as soon as possible.

Regards, Elias P.
Comment 45 James Le Cuirot gentoo-dev 2009-04-02 17:05:39 UTC
Hang on, the version I posted works fine with PHP though. Something must have been changed. Having a look...
Comment 46 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2009-04-02 20:24:21 UTC
thanks for the testing and feedback everybody.

the script was indeed changed - it now uses start-stop-daemon among other things.

thomasg: debug output is always welcome. just stating that it doesnt work is not very helpful.

elias p.: the patch you uploaded has been applied. if there is more you deem necessary it is more than welcome.

php-cgi works overhere. make sure that /usr/bin/spawn-fcgi and /etc/init.d/spawn-fcgi are in fact the one from the www-servers/spawn-fcgi package:
$ equery belongs /etc/init.d/spawn-fcgi

and that you have updated your conf files (using etc-update or dispatch-conf).
more testing and input welcome.
Comment 47 Gary Richards 2009-04-03 10:54:14 UTC
Created attachment 187181 [details]
debug log when starting spawn-fcgi using /usr/bin/php-cgi as FCGI_PROGRAM

# equery b /etc/init.d/spawn-fcgi
[ Searching for file(s) /etc/init.d/spawn-fcgi in *... ]
www-servers/spawn-fcgi-1.6.1 (/etc/init.d/spawn-fcgi)
# equery b /etc/conf.d/spawn-fcgi
[ Searching for file(s) /etc/conf.d/spawn-fcgi in *... ]
www-servers/spawn-fcgi-1.6.1 (/etc/conf.d/spawn-fcgi)

my /etc/conf.d/spawn-fcgi.php differs from the /etc/conf.d/spawn-fcgi like this:
--- /etc/conf.d/spawn-fcgi      2009-04-03 11:42:06.000000000 +0100
+++ /etc/conf.d/spawn-fcgi.php  2009-04-02 14:26:08.000000000 +0100
@@ -22,7 +22,7 @@
 # extension but not always. For PHP, you should usually point this to
 # /usr/bin/php-cgi.
 #
-FCGI_PROGRAM=/path/to/application.fcgi
+FCGI_PROGRAM=/usr/bin/php-cgi

 # The number of child processes to spawn. The default is 1. For PHP
 # applications, set this to 1 and use PHP_FCGI_CHILDREN instead.
@@ -37,8 +37,8 @@
 # The user and group to run your application as. If you do not specify these,
 # the application will be run as root:root.
 #
-FCGI_USER=
-FCGI_GROUP=
+FCGI_USER=nginx
+FCGI_GROUP=nginx

 # If your application requires additional environment variables, you need to
 # allow them here. Only the variables specified here, plus a few others
@@ -50,5 +50,5 @@
 # of child processes to spawn. The second is the number of requests to be
 # served by a single PHP process before it is restarted.
 #
-PHP_FCGI_CHILDREN=5
+PHP_FCGI_CHILDREN=2
 PHP_FCGI_MAX_REQUESTS=500


Entire debug log attached as a text file, this was the output from:
/etc/init.d/spawn-fcgi.php start --debug 1>>output.txt 2>>output.txt
Comment 48 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2009-04-03 21:24:22 UTC
i have comitted a new version of the init script - i dont think it will fix the issue described here, but who knows. you will have to remerge spawn-fcgi.

also try running strace before php, like so:
FCGI_PROGRAM="/usr/bin/strace -o /tmp/spawn-fcgi -ff /usr/bin/php-cgi"

Comment 49 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2009-04-04 10:47:42 UTC
can somebody on amd64 confirm that it work for them with php5?

a posixified version of the init script has been deployed. remerge spawn-fcgi to test it.
Comment 50 Gary Richards 2009-04-04 11:45:45 UTC
Created attachment 187283 [details]
Main process strace information

Using 

FCGI_PROGRAM="/usr/bin/strace -o /tmp/spawn-fcgi -ff /usr/bin/php-cgi"

Things seem to work normally. I get 5 php-cgi instances running and the various files under /tmp created by strace. For what it's worth, at this point nothing dies. If I think proceed to browse to my php app everything works as expected, even if the /etc/init.d/spawn-fcgi start does return [ !! ]

If I revert back to just
FCGI_PROGRAM="/usr/bin/php-cgi"
I get the same behaviour as before.
Comment 51 Gary Richards 2009-04-04 11:46:39 UTC
Created attachment 187285 [details]
strace output from one of the children

Strace output from one child, I diffed it against all other children and they returned no differences.
Comment 52 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2009-04-06 18:16:38 UTC
hhm, strange. i am at a complete loss....

one last thing you could try: call strace inbetween start-stop-daemon and spawn-fcgi... your terminal won't return using the followin patch, but it may give us some insight.

how many people are experiencing this problem?


--- spawn-fcgi  2009-04-06 20:08:44.000000000 +0200
+++ spawn-fcgi.orig     2009-04-06 20:06:40.000000000 +0200
@@ -75,8 +75,8 @@
                [ -n "${FCGI_SOCKET}" ] && SOCKET_OPTION="-s ${FCGI_SOCKET}-${X}"
                [ -n "${FCGI_PORT}" ] && INET_OPTION="-a ${FCGI_ADDRESS} -p $((${FCGI_PORT} + ${X} - 1))"

-               start-stop-daemon --start --pidfile ${P} ${E} --exec strace -- \
-               -o /tmp/spawn-fcgi -ff ${SPAWNFCGI} ${SOCKET_OPTION} ${INET_OPTION} -P ${P} ${OPTIONS} -- ${FCGI_PROGRAM}
+               start-stop-daemon --start --pidfile ${P} ${E} --exec ${SPAWNFCGI} -- \
+                       ${SOCKET_OPTION} ${INET_OPTION} -P ${P} ${OPTIONS} -- ${FCGI_PROGRAM}
                RETVAL=$?

                # Stop on error. Don't want to spawn a mess!
Comment 53 James Le Cuirot gentoo-dev 2009-04-06 22:09:29 UTC
Sorry I didn't try this until now, been very busy. I guessed right first time what the problem was. The PID file directory doesn't get created automatically and you removed the line to create it. Add that back and all will be well.

Tested and working on amd64.
Comment 54 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2009-04-07 08:40:47 UTC
the pid file directory is created by the ebuild. it shouldnt be necessary to create it in the startup script...

anyway - i have added it back. please remerge spawn-fcgi and retest.
gary: does this fix your problem?
Comment 55 James Le Cuirot gentoo-dev 2009-04-07 09:15:44 UTC
Hmm you're right, I hadn't checked the ebuild. I just assumed my directory was there from before. Maybe that's not it. It works fine for me other than that though.
Comment 56 Gary Richards 2009-04-07 09:55:26 UTC
To confuse matters, if I apply the patch in comment 52, although the terminal doesn't return, it seems to work fine. I get 5 php-cgi children started.

Are the files generated by strace any use if it works with the above patch?

It still doesn't work if I revert back to the original init script.

What I also find odd is that if I add an echo in front of the original start-stop-daemon line just to see what it's actually executing, and then copy and paste that into a shell, it works as I would expect it to. Yet when the exact same line runs in the init script RETVAL=1 for some reason
Comment 57 Thilo Bangert (RETIRED) (RETIRED) gentoo-dev 2009-04-08 14:25:03 UTC
ok - i am closing this bug (the new init script exists).
the issue with the init script not working is now tracked at bug 265454 - anybody having that problem is kindly asked to CC himself there (also please attach emerge --info)...

thanks for your input and help!
kind regards
Thilo