Project

General

Profile

Actions

Bug #3115

closed

Test the configuration file while lighttpd is running.

Added by dinoex about 1 month ago. Updated about 1 month ago.

Status:
Fixed
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:
No

Description

Running lighttpd -tt while lighttpd server process is running
does zero out the content on the server.pid-file on disk.

This leads the next start to fail, as pid of the running server process is not found and the old server is not killed/shutdown.
Starting the server fails.

/usr/local/etc/rc.d/lighttpd graceful Performing sanity check on lighttpd configuration: Stopping lighttpd gracefully. lighttpd not running? (check /var/run/lighttpd.pid). Starting lighttpd. 2021-11-05 07:35:40: (network.c.419) can't bind to socket: X.X.X.C:80: Address already in use /usr/local/etc/rc.d/lighttpd: WARNING: failed to start lighttpd

possible regression to lighttpd after 1.58

Actions #1

Updated by gstrauss about 1 month ago

  • Status changed from New to Patch Pending
  • Target version changed from 1.4.xx to 1.4.62

Thanks for the report.

The regression appears to be in lighttpd 1.4.60, due to commit af3df29a

This patch should fix it:

--- a/src/server.c
+++ b/src/server.c
@@ -962,7 +962,7 @@ static int server_graceful_state_bg (server *srv) {
             close(pid_fd);
             pid_fd = -1;
     }
-    if (srv->srvconf.pid_file) buffer_clear(srv->srvconf.pid_file);
+    srv->srvconf.pid_file = NULL;

     /* (original process is backgrounded -- even if no active connections --
      *  to allow graceful shutdown tasks to be run by server and by modules) */
@@ -1024,7 +1024,7 @@ static void server_graceful_state (server *srv) {
         server_sockets_close(srv);
         remove_pid_file(srv);
         /*(prevent more removal attempts)*/
-        if (srv->srvconf.pid_file) buffer_clear(srv->srvconf.pid_file);
+        srv->srvconf.pid_file = NULL;
     }
 }

@@ -1163,7 +1163,7 @@ static int server_main_setup (server * const srv, int argc, char **argv) {
        }

        if (test_config) {
-               if (srv->srvconf.pid_file) buffer_clear(srv->srvconf.pid_file);
+               srv->srvconf.pid_file = NULL;
                if (1 == test_config) {
                        printf("Syntax OK\n");
                } else { /*(test_config > 1)*/
@@ -1186,7 +1186,7 @@ static int server_main_setup (server * const srv, int argc, char **argv) {
                graceful_shutdown = 1;
                srv->sockets_disabled = 2;
                srv->srvconf.dont_daemonize = 1;
-               if (srv->srvconf.pid_file) buffer_clear(srv->srvconf.pid_file);
+               srv->srvconf.pid_file = NULL;
                if (srv->srvconf.max_worker) {
                        srv->srvconf.max_worker = 0;
                        log_error(srv->errh, __FILE__, __LINE__,
@@ -1707,7 +1707,7 @@ static int server_main_setup (server * const srv, int argc, char **argv) {
                        close(pid_fd);
                        pid_fd = -1;
                }
-               if (srv->srvconf.pid_file) buffer_clear(srv->srvconf.pid_file);
+               srv->srvconf.pid_file = NULL;

                fdlog_pipes_abandon_pids();
                srv->pid = getpid();

Actions #2

Updated by gstrauss about 1 month ago

  • Status changed from Patch Pending to Fixed
Actions

Also available in: Atom