Skip to content

Commit c7f025d

Browse files
author
Justin Erenkrantz
committed
Fix some piped log problems: bogus "piped log program '(null)'
failed" messages during restart and problem with the logger respawning again after Apache is stopped. PR: 21648, 24805 Reviewed by: trawick, jerenkrantz, nd git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@102889 13f79535-47bb-0310-9956-ffa450edef68
1 parent 04c883e commit c7f025d

2 files changed

Lines changed: 28 additions & 14 deletions

File tree

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
Changes with Apache 2.0.49
22

3+
*) Fix some piped log problems: bogus "piped log program '(null)'
4+
failed" messages during restart and problem with the logger
5+
respawning again after Apache is stopped. PR 21648, PR 24805.
6+
[Jeff Trawick]
7+
38
*) Fixed file extensions for real media files and removed rpm extension
49
from mime.types. PR 26079. [Allan Sandfeld <kde carewolf.com>]
510

server/log.c

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include "http_log.h"
4949
#include "http_main.h"
5050
#include "util_time.h"
51+
#include "ap_mpm.h"
5152

5253
typedef struct {
5354
char *t_name;
@@ -769,26 +770,34 @@ static void piped_log_maintenance(int reason, void *data, apr_wait_t status)
769770
{
770771
piped_log *pl = data;
771772
apr_status_t stats;
773+
int mpm_state;
772774

773775
switch (reason) {
774776
case APR_OC_REASON_DEATH:
775777
case APR_OC_REASON_LOST:
776-
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
777-
"piped log program '%s' failed unexpectedly",
778-
pl->program);
779-
pl->pid = NULL;
778+
pl->pid = NULL; /* in case we don't get it going again, this
779+
* tells other logic not to try to kill it
780+
*/
780781
apr_proc_other_child_unregister(pl);
781-
if (pl->program == NULL) {
782-
/* during a restart */
783-
break;
782+
stats = ap_mpm_query(AP_MPMQ_MPM_STATE, &mpm_state);
783+
if (stats != APR_SUCCESS) {
784+
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
785+
"can't query MPM state; not restarting "
786+
"piped log program '%s'",
787+
pl->program);
784788
}
785-
if ((stats = piped_log_spawn(pl)) != APR_SUCCESS) {
786-
/* what can we do? This could be the error log we're having
787-
* problems opening up... */
788-
char buf[120];
789+
else if (mpm_state != AP_MPMQ_STOPPING) {
789790
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
790-
"piped_log_maintenance: unable to respawn '%s': %s",
791-
pl->program, apr_strerror(stats, buf, sizeof(buf)));
791+
"piped log program '%s' failed unexpectedly",
792+
pl->program);
793+
if ((stats = piped_log_spawn(pl)) != APR_SUCCESS) {
794+
/* what can we do? This could be the error log we're having
795+
* problems opening up... */
796+
char buf[120];
797+
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
798+
"piped_log_maintenance: unable to respawn '%s': %s",
799+
pl->program, apr_strerror(stats, buf, sizeof(buf)));
800+
}
792801
}
793802
break;
794803

@@ -798,9 +807,9 @@ static void piped_log_maintenance(int reason, void *data, apr_wait_t status)
798807
break;
799808

800809
case APR_OC_REASON_RESTART:
801-
pl->program = NULL;
802810
if (pl->pid != NULL) {
803811
apr_proc_kill(pl->pid, SIGTERM);
812+
pl->pid = NULL;
804813
}
805814
break;
806815

0 commit comments

Comments
 (0)