Project

General

Profile

[Solved] Reload config graceful for fastcgi

Added by sodonna over 9 years ago

Is it possible to reload the config files gracefully from fastcgi point of view?
If I run service lighttpd reload it is graceful for lighty, but I see error messages from fastcgi when there is load on the server.

I have lighttpd/1.4.31 (ssl) on Debian 7 and my fastcgi-php.conf is fairly standard:

fastcgi.server += ( ".php" =>
        ((
                "bin-path" => "/usr/bin/php-cgi",
                "socket" => "/var/run/lighttpd/php.socket",
                "max-procs" => 4,
                "bin-environment" => (
                        "PHP_FCGI_CHILDREN" => "40",
                        "PHP_FCGI_MAX_REQUESTS" => "10000" 
                ),
                "bin-copy-environment" => (
                        "PATH", "SHELL", "USER" 
                ),
                "broken-scriptfilename" => "enable" 
        ))
)

This is the contents of error.log during reload
2014-10-23 00:05:55: (server.c.1442) [note] graceful shutdown started
2014-10-23 00:05:55: (log.c.166) server started
2014-10-23 00:06:07: (server.c.1558) server stopped by UID = 0 PID = 18765
2014-10-23 00:06:08: (mod_fastcgi.c.1732) connect failed: No such file or directory on unix:/var/run/lighttpd/php.socket-0
2014-10-23 00:06:08: (mod_fastcgi.c.3002) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 12
2014-10-23 00:06:08: (mod_fastcgi.c.1732) connect failed: No such file or directory on unix:/var/run/lighttpd/php.socket-3
2014-10-23 00:06:08: (mod_fastcgi.c.3002) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 12
2014-10-23 00:06:08: (mod_fastcgi.c.1732) connect failed: No such file or directory on unix:/var/run/lighttpd/php.socket-2
2014-10-23 00:06:08: (mod_fastcgi.c.3002) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 12
2014-10-23 00:06:08: (mod_fastcgi.c.1732) connect failed: No such file or directory on unix:/var/run/lighttpd/php.socket-1
2014-10-23 00:06:08: (mod_fastcgi.c.3002) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 12
2014-10-23 00:06:08: (mod_fastcgi.c.3570) all handlers for /example.php?var1=1&var2=2 on .php are down.

Thanks!


Replies (1)

RE: [Solved] Reload config graceful for fastcgi - Added by gstrauss about 7 years ago

2014-10-23 00:05:55: (server.c.1442) [note] graceful shutdown started
2014-10-23 00:05:55: (log.c.166) server started
2014-10-23 00:06:07: (server.c.1558) server stopped by UID = 0 PID = 18765

The reload script is probably not waiting for the first server to gracefully exit prior to starting up a new server with the new config. Do not shutdown the server in the background. Once the first server finishes handling requests, it removes the sockets for the fastcgi backends that the lighttpd server created. If the new server is using those paths, then you'll see those errors.

Alternatively, run the fastcgi backends independently from lighttpd.conf instead of having lighttpd start the fastcgi backends.

lighttpd 1.4.46 will have a new feature to do a graceful restart when SIGUSR1 is received, replacing scripts that currently stop and then start lighttpd to reload the config.

    (1-1/1)