Changeset 7151:9ef704d8563a in nginx


Ignore:
Timestamp:
10/17/17 16:52:16 (2 years ago)
Author:
Maxim Dounin <mdounin@…>
Branch:
default
Phase:
public
Message:

Core: free shared memory zones only after reconfiguration.

This is what usually happens for zones no longer used in the new
configuration, but zones where size or tag were changed were freed
when creating new memory zones. If reconfiguration failed (for
example, due to a conflicting listening socket), this resulted in a
segmentation fault in the master process.

Reported by Zhihua Cao,
http://mailman.nginx.org/pipermail/nginx-devel/2017-October/010536.html.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/core/ngx_cycle.c

    r7032 r7151  
    471471            }
    472472
    473             ngx_shm_free(&oshm_zone[n].shm);
    474 
    475473            break;
    476474        }
     
    663661            }
    664662
    665             if (oshm_zone[i].shm.name.len == shm_zone[n].shm.name.len
    666                 && ngx_strncmp(oshm_zone[i].shm.name.data,
    667                                shm_zone[n].shm.name.data,
    668                                oshm_zone[i].shm.name.len)
    669                 == 0)
     663            if (oshm_zone[i].shm.name.len != shm_zone[n].shm.name.len) {
     664                continue;
     665            }
     666
     667            if (ngx_strncmp(oshm_zone[i].shm.name.data,
     668                            shm_zone[n].shm.name.data,
     669                            oshm_zone[i].shm.name.len)
     670                != 0)
     671            {
     672                continue;
     673            }
     674
     675            if (oshm_zone[i].tag == shm_zone[n].tag
     676                && oshm_zone[i].shm.size == shm_zone[n].shm.size
     677                && !oshm_zone[i].noreuse)
    670678            {
    671679                goto live_shm_zone;
    672680            }
     681
     682            break;
    673683        }
    674684
Note: See TracChangeset for help on using the changeset viewer.