You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2017/03/30 20:12:47 UTC

[Bug 60945] New: Apache doesn't manage PidFile's properly

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


[Bug 60945] Apache doesn't manage PidFile's properly

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60945

--- Comment #2 from Ngie Cooper <ya...@gmail.com> ---
(In reply to Eric Covener from comment #1)
> > 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.
> 
> "PidFile" isn't syntactically valid inside of VirtualHost.  What's the
> relationship of this to the rest of the report?

I'm sorry -- I misread the docs yesterday (
http://httpd.apache.org/docs/current/mod/mpm_common.html#pidfile ). It has
nothing to do with VirtualHost directives (I misspoke in comment # 0).

Thanks!

-- 
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


[Bug 60945] Apache doesn't manage PidFile's properly

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60945

Eric Covener <co...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Eric Covener <co...@gmail.com> ---
> 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.

"PidFile" isn't syntactically valid inside of VirtualHost.  What's the
relationship of this to the rest of the report?

-- 
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