httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 60945] New: Apache doesn't manage PidFile's properly
Date Thu, 30 Mar 2017 20:12:47 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=60945

            Bug ID: 60945
           Summary: Apache doesn't manage PidFile's properly
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: bugs@httpd.apache.org
          Reporter: yaneurabeya@gmail.com
  Target Milestone: ---

We integrate apache into our work project, and we ran into an issue where the
process management service (that tracks the apache process via the FreeBSD
process table), said that the process had died, but because httpd hadn't
removed the process on our version, it claimed that the PID file was open, so
(in theory) the process itself was running (even though the process with the
PID in the pidfile didn't correspond to the apache instance).

Getting to the point, PidFile management with apache is done improperly -- in
particular, this logic doesn't keep the pidfile open (over the course of the
worker process lifetime), and doesn't lock the pidfile with fcntl(2), or
something similar via open(2):

1555     if ((rv = apr_file_open(&pid_file, fname,
1556                             APR_WRITE | APR_CREATE | APR_TRUNCATE,
1557                             APR_UREAD | APR_UWRITE | APR_GREAD |
APR_WREAD, p))
1558         != APR_SUCCESS) {
1559         ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, APLOGNO(00099)
1560                      "could not create %s", fname);
1561         ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, APLOGNO(00100)
1562                      "%s: could not log pid to file %s",
1563                      ap_server_argv0, fname);
1564         exit(1);
1565     }
1566     apr_file_printf(pid_file, "%" APR_PID_T_FMT APR_EOL_STR, mypid);
1567     apr_file_close(pid_file);
1568     saved_pid = mypid;

FreeBSD has a set of shims for this that could be used (pidfile_open(3)), but
unfortunately they're not portable as-is (just to the various BSD versions,
with some minor adjustments).

Apache needs to learn how to do pid files properly so it can be managed
properly. Otherwise, there's no point to having PidFile's per VirtualHost that
cannot be managed.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message