Skip to content

Lua's fake requests remain uncleaned in successful cases #1098

Open
@Dslt

Description

@Dslt

Recently I have had difficulties with such error:
2017/06/07 04:10:42 [alert] 4579#0: *35005 1024 worker_connections are not enough while connecting to upstream

What I found out:
If I'm right, the connections do not close in successful cases in all ngx_http_lua_ssl*_ modules.

Usually connections are created:

fc = ngx_http_lua_create_fake_connection(NULL);

However, the cleaning function is only called in unsuccessful cases:

failed:

    if (r && r->pool) {
        ngx_http_lua_free_fake_request(r);
    }

    if (fc) {
        ngx_http_lua_close_fake_connection(fc);
    }

In successful cases, a handler just return a value:

    if (rc >= NGX_OK || rc == NGX_ERROR) {
        cctx->done = 1;
        ...
        ngx_log_debug2(...);
        ...
        return <something "good">;
    }

Maybe I don't understand something in the architecture, but inserting the cleanup code before returning the "good" value helped me.

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