Skip to content

Memory leak due to use of ngx_cycle->pool in partial (wildcard) purge code. #45

@TaylanUB

Description

@TaylanUB

I believe this is effectively a memory leak:

/* I don't know if it's a good idea to use the ngx_cycle pool for this,
but the request is not available here */
key_in_file = ngx_pcalloc(ngx_cycle->pool, sizeof(u_char) * (len + 1));

If I understand correctly, the ngx_cycle pool lives until a config reload is issued.

Indeed, on our server where I recently started using wildcard purging, I've begun observing Nginx using more and more memory, until I issue a reload, so this matches perfectly.

It appears there is an ngx_pfree() function that should probably be called on key_in_file once we're done with it. That would be after line 1365, before exiting the scope in which key_in_file is set.

I hope this module is still maintained? :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions