nginx module memory problem

Maxim Dounin mdounin at mdounin.ru
Thu Oct 4 16:20:33 UTC 2012


Hello!

On Thu, Oct 04, 2012 at 02:13:17PM +0900, 김영진 wrote:

> hi, i am web server(nginx) module developer.
> my nginx modules has a major problem.
> maybe... this problem is seem to nginx core bug.
> i hope this is my module problem. Because, i wish the problem to be settled
> soon.
> 
> *my module function:*
> large post data logging from specified file(nginx.conf setting :
> /home1/test_access.log)
> *problem:*
> constant use of memory(nginx-1.2.2 , same situation)
> [image: 본문 이미지 1]

[...]

> rc_post = ngx_http_read_client_request_body(r,
> ngx_testmodule_post_read_request_body);
> 
> ngx_testmodule_resheader(r);
> ...
> return ngx_http_send_response(r, NGX_HTTP_OK, &ngx_http_text_type, &cv);
> }
> 
> 
> i have tested my nginx module. but... i don't know.. difficult problem..
> i am turning to you for help.

One obvious problem in your code is that you use 
ngx_http_read_client_request_body() incorrectly.

After a call to ngx_http_read_client_request_body() you _must_ 
follow the pattern

    rc = ngx_http_read_client_request_body(r, ...);

    if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
        return rc;
    }

    return NGX_DONE;

See e.g. ngx_http_proxy_module.c for an example.  Failing to do so 
will likely result in request hangs/socket leaks.

-- 
Maxim Dounin
http://nginx.com/support.html



More information about the nginx-devel mailing list