nginx, echo module & lua

agentzh agentzh at
Thu May 3 12:34:12 UTC 2012

On Thu, May 3, 2012 at 7:34 AM, Pierre <serarien at> wrote:
>> There's already several Lua drivers based on that, including
>> memcached, redis, mysql, http, and mongodb. For instance, the
>> lua-resty-redis library:
> how can I combine cosocket & foreign upstream ?
> also, I didn't find any example involving cosocket between locations, or maybe
> I'm getting it wrong.

The cosocket API is used to talk to remote servers in TCP or unix
domain sockets directly. It does not support the subrequest model at
all so it is not used for reusing existing upstream modules.

The "cosocket" term is short for "coroutine-based socket", it is a
parallel implementation as ngx_http_usptream, see the following graph:

>> > 2. when in config: set_by_lua_file $varname luafile.lua , and luafile.lua
>> > references to ngx.ctx,
>> > I get the following error:
>> > (lua-error) request ctx found
>> > according to the doc, ngx.ctx is available in set_lua*, but does not work.
>> > Would anybody suggest
>> > me a workaround ?
>> >
>> This is indeed a bug. Thanks for reporting this!
>> I've just committed a patch for it:
> works like a charm, thanks !

Sorry, my previous patch introduced a bad memory leak and I've just
committed the following patch to fix this:

Best regards,

More information about the nginx mailing list