Bug 55072 - ErrorLog doesn't work well when apache shutdown
Summary: ErrorLog doesn't work well when apache shutdown
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.5-HEAD
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-07 02:02 UTC by Weiye
Modified: 2015-11-26 09:25 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Weiye 2013-06-07 02:02:47 UTC
The problem is that if we configured the ErrorLog directive piped with rotatelog, logs in pool cleanup hook is always missing when we shutdown the apache server (restart is OK).

    ErrorLog "|/usr/local/apache2/bin/rotatelogs -l /home/user/log/event.log.%Y-%m-%d 86400"

   If we don't use the rotatelog feature, it works fine.

   ErrorLog "logs/error_log"

   We have tested the latest released apache, the problem always exists.
    
   The related program is as following:

apr_status_t destory_lock(void *not_used)
   {
    ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "enter destroy"); // this log is always missing when shutdown apache
    return APR_SUCCESS;
    }

int filerepair_post_config(apr_pool_t *pconf, apr_pool_t *plog,
                             apr_pool_t *ptemp, server_rec *s){
    apr_pool_cleanup_register(pconf, NULL, destory_lock, apr_pool_cleanup_null);
       return APR_SUCCESS;
                                              
}
Comment 1 Eric Covener 2013-06-07 10:23:59 UTC
Does creating a sub-pool of pconf and registering a cleanup on that instead work around the issue?  log.c uses a pconf cleanup to shutdown the piped logger.

Can you try testing w/ the "APR_KILL_AFTER_TIMEOUT" line removed from log.c (separate or in conjunction w/ the above)
Comment 2 Weiye 2013-06-08 11:25:56 UTC
The attempt that creating sub pool only seems not work. 
After the line "apr_pool_note_subprocess(p, procnew, APR_KILL_AFTER_TIMEOUT);" in log.c is commetted out , it will log successfully regardless of whether the sub-pool is created or not.
(In reply to Eric Covener from comment #1)
> Does creating a sub-pool of pconf and registering a cleanup on that instead
> work around the issue?  log.c uses a pconf cleanup to shutdown the piped
> logger.
> 
> Can you try testing w/ the "APR_KILL_AFTER_TIMEOUT" line removed from log.c
> (separate or in conjunction w/ the above)
Comment 3 srinivas.und 2015-11-26 09:25:16 UTC
I'm also facing the same issue with Apache 2.4 on Solaris. I tried with removing the line "APR_KILL_AFTER_TIMEOUT" from log.c, but it's not resolved. 
Can you please suggest me any work around.