Giter VIP home page Giter VIP logo

no-pool-nginx's Introduction

Name

no-pool-nginx - NGINX patch to disable NGINX's memory pool for debugging.

Description

This is a set of a patch files to the nginx source. It replaces nginx's pool machanism with plain malloc & free to help tools like valgrind's memcheck to detect memory issues more reliably.

Usage

cd nginx-VERSION/
patch -p1 < /path/to/nginx-VERSION-no_pool.patch
./configure
make
make install

Copyright & License

This program is licenced under the BSD licence.

Copyright (c) 2010-2017, Yichun "agentzh" Zhang [email protected], OpenResty Inc.

Copyright (c) 2010, Shrimp [email protected].

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the Taobao Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

no-pool-nginx's People

Contributors

agentzh avatar hnakamur avatar shrimp avatar thibaultcha avatar xiaocang avatar zhuizhuhaomeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

no-pool-nginx's Issues

patch for nginx-1.1.14

When can this be released? I am getting valgrind error with 1.1.13, but not with 1.1.14. But I am unsure if it is a pooling issue or not. Let me know when this can be released!

Thanks

Chris

ngx_reset_pool lead a core dump

when i am using geo module for nginx0.8.54, the calling path of core dump is ngx_http_geo() ->ngx_reset_pool()-> ngx_create_pool(sizeof(ngx_pool_t), NULL) -> ngx_alloc(size, log) ->ngx_log_debug2(.. log ..) , here log is set to NULL in ngx_reset_pool. so ...

Actually, there is an other bug in ngx_reset_pool(), If caller A calls ngx_reset_pool to reset its pool (A->pool), and after that, it reuse A->poll , it will get a core dump because A->poll is destory in ngx_reset_pool but not set to the new one.

so, ngx_reset_pool(ngx_pool_t _pool) should be ngx_reset_pool(ngx_pool_t *_pool) , but its behave should be to reset the pool rather than to destroy it and get a new one. So to solve the problem totally, it would better to re-implement like this:
void
ngx_reset_pool(ngx_pool_t *pool)
{
ngx_pool_data_t *p, *tmp;
ngx_pool_large_t *l;

for (l = pool->large; l ; l = l->next) {

    ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, "free: %p", l->alloc);

    if (l->alloc) {
        ngx_free(l->alloc);                                                                                                            
    }   
}   

pool->large = NULL;

p = pool->d->next;
while (p != pool->d) {
    tmp = p;
    ngx_free(p->alloc);
    p->prev->next = p->next;
    p->next->prev = p->prev;
    p = p->next;
    ngx_free(tmp);
}   

ngx_free(pool->d->alloc);
pool->d->alloc = NULL;

}
Please check it ,thanks.

No patches for stable?

Might I ask why it seems you only support mainline versions? I have test scenarios in which I use stable versions of nginx.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.