Ticket #2288: fix-core-on-reloading.patch

File fix-core-on-reloading.patch, 1.5 KB (added by al.drozdov@…, 4 years ago)

A patch fixes the bug

  • src/core/ngx_cycle.c

    diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
    index 6978c3e4..4420bea2 100644
    a b ngx_init_cycle(ngx_cycle_t *old_cycle)  
    640640
    641641    /* close and delete stuff that lefts from an old cycle */
    642642
     643    /*
     644     * log the remaining events of the old cycle with the new log as the old one
     645     * may become unusable while cleaning the data
     646     */
     647
     648    log = cycle->log;
     649    old_cycle->log = log;
     650    old_cycle->pool->log = log;
     651    conf.temp_pool->log = log;
     652
    643653    /* free the unnecessary shared memory */
    644654
    645655    opart = &old_cycle->shared_memory.part;
    old_shm_zone_done:  
    795805        ngx_memzero(ngx_old_cycles.elts, n * sizeof(ngx_cycle_t *));
    796806
    797807        ngx_cleaner_event.handler = ngx_clean_old_cycles;
    798         ngx_cleaner_event.log = cycle->log;
    799808        ngx_cleaner_event.data = &dumb;
    800809        dumb.fd = (ngx_socket_t) -1;
    801810    }
    802811
    803812    ngx_temp_pool->log = cycle->log;
     813    ngx_cleaner_event.log = cycle->log;
    804814
    805815    old = ngx_array_push(&ngx_old_cycles);
    806816    if (old == NULL) {
    old_shm_zone_done:  
    818828
    819829failed:
    820830
     831    /*
     832     * log the remaining events with the previous log as the current one
     833     * may become unusable while cleaning the data
     834     */
     835
     836    cycle->log = log;
     837    pool->log = log;
     838    conf.temp_pool->log = log;
     839    conf.log = log;
     840
    821841    if (!ngx_is_init_cycle(old_cycle)) {
    822842        old_ccf = (ngx_core_conf_t *) ngx_get_conf(old_cycle->conf_ctx,
    823843                                                   ngx_core_module);