Ngx_openresty stable version 1.0.11.28 released!

Hi, folks!

I’m happy to announce that ngx_openresty’s new stable version 1.0.11.28
has
just been released. You can download the source tarball from the
Download
page on openresty.org:

OpenResty® - Open source

This is the first (and also the last) stable version of ngx_openresty
based
on the Nginx 1.0.11 core. Future versions will be based on the latest
Nginx
stable version.

This version features the new “cosocket API” shipped with the ngx_lua
module as well as various new Lua client libraries based on that (for
Memcached, Redis, MySQL, and others), which are all 100% nonblocking.

Special thanks go to all our contributors and users!

Here goes the complete change log, as compared to the last stable
version,
1.0.10.48, released about two months ago.

  • feature: bundle Piotr S.'s
    CoolkitNginxModulehttps://github.com/FRiCKLE/ngx_coolkit/0.2rc1,
    which is also enabled by default.
  • feature: bundle
    LuaRestyMySQLLibraryhttps://github.com/agentzh/lua-resty-mysql0.06,
    which is enabled by default.
  • feature: bundle
    LuaRestyRedisLibraryhttps://github.com/agentzh/lua-resty-redis0.08,
    which is enabled by default.
  • feature: bundle
    LuaRestyMemcachedLibraryhttps://github.com/agentzh/lua-resty-memcached0.06,
    which is enabled by default.
  • feature: bundle
    LuaRestyUploadLibraryhttps://github.com/agentzh/lua-resty-upload0.02,
    which is enabled by default. thanks Taylor Weibley for sponsoring the
    development work.
  • feature: bundle
    LuaRestyStringLibraryhttps://github.com/agentzh/lua-resty-string0.05,
    which is enabled by default.
  • upgraded LuaNginxModule to 0.5.0rc21.
    • feature: implemented the coroutine-based TCP and Unix Domain
      client
      socket API (aka the “cosocket” API) that is mostly compatible with
      the
      LuaSocket
      http://w3.impa.br/~diego/software/luasocket/tcp.htmllibrary.
    • feature: implemented built-in connection pool support for the
      cosocket API.
    • feature: added new function
      ngx.req.socket()http://wiki.nginx.org/HttpLuaModule#ngx.req.socketto
      return a cosocket object for the downstream connection so as to do
      streaming request body reading. thanks Taylor Weibley for
      sponsoring the
      development work.
    • feature: added new directive
      lua_http10_bufferinghttp://wiki.nginx.org/HttpLuaModule#lua_http10_bufferingwhich
      is
      on by default.
    • feature: added user flags support to the shared dictionary
      APIhttp://wiki.nginx.org/HttpLuaModule#ngx.shared.DICT.
      thanks Brian A…
    • feature: added new method flush_all to the shared dict. thanks
      Weiqiang Li.
    • feature: added the
      ngx.sha1_binhttp://wiki.nginx.org/HttpLuaModule#ngx.sha1_binmethod
      which returns the binary form of the
      SHA-1 digest.
    • feature: added constant ngx.null which is a NULL light userdata
      to
      represent nil values in Lua tables and etc. this is compatible
      with
      at least
      lua-cjsonhttp://www.kyne.com.au/~mark/software/lua-cjson.phplibrary’s
      cjson.null constant.
    • feature: allow use of ngx.null in
      ngx.log()http://wiki.nginx.org/HttpLuaModule#ngx.logand
      print() http://wiki.nginx.org/HttpLuaModule#print arguments.
    • feature: added new constant ngx.DECLINED.
    • bugfix: we did not declare C variables at the beginning of the
      current code block in ngx_http_lua_del_thread, reported by
      runner-mei
      in github issue
      #93https://github.com/chaoslawful/lua-nginx-module/issues/93
      .
    • bugfix: incorrectly used ngx_conf_log_error by feeding NGX_ERROR
      as
      the first argument, as reported by runner-mei in github issue
      #92https://github.com/chaoslawful/lua-nginx-module/issues/92
      .
    • bugfix: spelling errors in Lua exception message text.
    • bugfix:
      access_by_luahttp://wiki.nginx.org/HttpLuaModule#access_by_luacould
      not work with the satisfy
      any configuration.
    • bugfix: now we recycle the special flush buffer and chain link
      for
      ngx.flush http://wiki.nginx.org/HttpLuaModule#ngx.flush to
      prevent
      request-scoped memory leaks when emitting long data streams to the
      downstream.
    • bugfix: time stamps could overflow on 32-bit systems in the
      shared
      dict API; now we explicitly use 64-bit integers.
    • bugfix: the shared dict storage might leak memory in the store:
      ngx_http_lua_shdict_lookup incorrectly assumed that nodes with
      identical keys are linked together, which might not be true after
      tree
      re-balancing. thanks the patch from Lanshun Zhou.
    • bugfix: the exptime argument to shdict:set/add/etc methods was
      incorrectly ignored when the flags argument is also specified.
      thanks
      the patch from Brian A…
    • bugfix: now we avoid using luaL_checkstring which could do
      another long
      jump on its own. thanks Wang Bin.
    • bugfix: when the parent request takes a request body, the
      subrequest does not take any bodies, and the subrequest’s method
      is neither
      PUT nor POST, then the subrequest will no longer inherit the
      parent
      request’s request body. thanks Ou Yuanning for reporting this
      issue.
    • bugfix: C macro directives were used inside a C macro argument
      which made (at least) gcc 3.2.3 unhappy. thanks Feng Bin.
    • bugfix: setting ngx.header.last_modified was not implemented
      fully.
      thanks Brian A…
    • optimize: removed a redundant piece of code for subrequest
      headers_in fixes in ngx_http_lua_adjust_subrequest.
    • optimize: introduced a minor optimization that we can save one
      recvcall when the read event is active and the read event is not
      ready.
    • optimize: now we recycle the downstream output buffers to save
      memory and dynamic allocation times for long-running requests with
      huge
      outputs.
    • optimize: optimized the chain-link and buf recycle logic for the
      subrequest API and make it share free buffers with the cosocket
      API.
    • docs: documented the max concurrent subrequest count limitation
      and
      max error log line size limit.
    • docs: fixed various typos in docs. thanks Wang Bin.
  • upgraded EchoNginxModule to 0.38rc2.
  • upgraded SrcacheNginxModule to 0.13rc6.
    • bugfix: fixed a typo in an error message text for response
      truncation check in
      srcache_storehttp://wiki.nginx.org/HttpSRCacheModule#srcache_store
      .
    • feature: now
      srcache_storehttp://wiki.nginx.org/HttpSRCacheModule#srcache_storediscards
      responses that are obviously truncated when the actual output data
      is shorter than what is declared in its Content-Length response
      header. thanks Greg Grensteiner.
    • bugfix: the access phase handler actually ran in a phase later
      than
      the access phase.
    • bugfix: HTTP HEAD requests that lead to a cache hits would cause
      memory issues like invalid reads.
  • upgraded Redis2NginxModule to 0.08rc4.
    • bugfix: redis “nil multi bulk replies” did not parse at all.
      thanks
      Guo Ying for reporting this issue.
  • upgraded LuaRedisParserLibrary to 0.09rc7.
    • bugfix: redis “nil multi bulk replies” did not parse at all.
      thanks
      Guo Ying for reporting this issue.
    • bugfix: remove unneeded string push operations. thanks Brian
      Akins.
  • upgraded XssNginxModule to 0.03rc9, RdsCsvNginxModule to 0.05rc1,
    and
    Redis2NginxModule to 0.08rc3, allowing enabling DDEBUG=1 globally.
  • upgraded IconvNginxModule to 0.10rc7.
    • bugfix: enabling DDEBUG=1 globally lead to compilation errors.
    • bugfix: could not work with HTTP 1.0 requests.
    • optimize: only register output filters when the iconv_filter is
      actually used in the config file.
  • upgraded PostgresNginxModule to 0.9.
    • bugfix: Fix compatibility with poll, select and /dev/poll event
      models.
    • bugfix: Fix compatibility with PostgreSQL 9.x.
    • bugfix: Fix compatibility with nginx-1.1.4+.
  • bugfix: applied the official hotfix #1
    patchhttp://luajit.org/download/beta9_hotfix1.patchfor
    LuaJIT 2.0.0 beta9.
  • now we enable the -DLUA_USE_APICHECK -DLUA_USE_ASSERT flags for
    LuaJITwhen the
    –with-debug option is specified.
  • apply the max_subrequests
    patchhttps://github.com/agentzh/ngx_openresty/blob/master/patches/nginx-1.0.11-max_subrequests.patchto
    allow the
    NGX_HTTP_MAX_SUBREQUESTS macro to be overridden from the outside and
    adjusted the default value from 50 to 200 because 50 is a little too
    conservative.
  • applied the upstream_pipelining patch to the nginx core, as
    discussed
    here:
    http://mailman.nginx.org/pipermail/nginx-devel/2012-March/002040.htmlthis
    patch is required at least for the pipelined requests support in nginx
    upstream modules.
  • applied the null-character-fixes patch from the mainstream. The bug
    did result in a disclosure of previously freed memory if upstream
    server
    returned specially crafted response, potentially exposing sensitive
    information.
  • upgraded the Nginx core to 1.0.11.

As always, you’re welcome to report bugs and feature requests either
here
or directly to me :slight_smile:

OpenResty (aka. ngx_openresty) is a full-fledged web application server
by
bundling the standard Nginx core, lots of 3rd-party Nginx modules, as
well
as most of their external dependencies.

By taking advantage of various well-designed Nginx modules,
OpenRestyeffectively turns the Nginx server into a powerful web app
server, in which
the web developers can use the Lua programming language to script
various
existing Nginx C modules and Lua modules and construct extremely
high-performance web applications that is capable to handle 10K+
connections.

OpenResty aims to run your server-side web app completely in the Nginx
server, leveraging Nginx’s event model to do non-blocking I/O not only
with
the HTTP clients, but also with remote backends like MySQL, PostgreSQL,
Memcached, and Redis.

You can find more details on the homepage of ngx_openresty here:

http://openresty.org

Enjoy!
-agentzh

Hi agentzh,

do you know the Kyoto Tycoon ( http://fallabs.com/ )?

Do you have plans to add it to openresty?

Best regards

Aleks

On
25-03-2012 09:41, agentzh wrote:

Hi, folks!

I’m happy to
announce that ngx_openresty’s new stable version 1.0.11.28 has just been
released. You can download the source tarball from the Download page on
openresty.org [1]:

OpenResty® - Open source [2]

This is
the first (and also the last) stable version of ngx_openresty based on
the Nginx 1.0.11 core. Future versions will be based on the latest Nginx
stable version.
[SNIPP]
You can find more details on the homepage
of ngx_openresty here:

http://openresty.org [3]

Enjoy!

-agentzh

Links:

On Mon, Mar 26, 2012 at 8:29 AM, Aleksandar L. [email protected]
wrote:

do you know the Kyoto Tycoon ( http://fallabs.com/ )?

Yes.

Do you have plans to add it to openresty?

As long as it has a sane Lua binding :slight_smile: The current official Lua
binding incorrectly uses Lua globals to store its internal states,
which will cause troubles in the context of ngx_lua.

Best,
-agentzh

On Mon, Mar 26, 2012 at 12:10 PM, agentzh [email protected] wrote:

As long as it has a sane Lua binding :slight_smile: The current official Lua
binding incorrectly uses Lua globals to store its internal states,
which will cause troubles in the context of ngx_lua.

Not sure but are you meaning to run kyoto inside nginx?
The binary protocol of ktycoon is simple and well documented.

On 26-03-2012 06:10, agentzh wrote:

binding incorrectly uses Lua globals to store its internal states,
which will cause troubles in the context of ngx_lua.

There is the possibility to use the memcache interface :wink:

I use it with

:wink:

Cheers
Aleks

Due to the fact that Kyoto Tycoon can speak memcache I think it
should be possible to use Kyoto Tycoon also direct with

memcache
module.

Due to the fact that I have not a use case for this I hope the
‘comunity’ have some

ideas or needs :wink:

Cheers

Aleks

On
26-03-2012 09:05, David Yu wrote:

On Mon, Mar 26, 2012 at 12:10 PM,
agentzh <[email protected] [5]> wrote:

On Mon, Mar 26, 2012 at
8:29 AM, Aleksandar L. <[email protected] [1]> wrote:

do you know
the Kyoto Tycoon ( http://fallabs.com/ [2] )?

Yes.

Do you have plans to add it to openresty?

As long as it has
a sane Lua binding :slight_smile: The current official Lua
binding incorrectly
uses Lua globals to store its internal states,
which will cause
troubles in the context of ngx_lua.

Not sure but are you meaning to
run kyoto inside nginx?
The binary protocol of ktycoon is simple and
well documented.

Best,
-agentzh


nginx mailing list

[email protected] [3]

nginx Info Page
[4]


When the cat is away, the mouse is alone.

  • David Yu

Links:

[1] mailto:[email protected]
[2] http://fallabs.com/
[3]
mailto:[email protected]
[4]
nginx Info Page
[5]
mailto:[email protected]

On 27-03-2012 03:07, agentzh wrote:

API:

https://github.com/agentzh/lua-resty-memcached

But I’m fraid the functionalities exposed by KT’s memcached interface
are a little limited, a Lua binding for KT’s native wire protocol
based on ngx_lua’s cosocket may still be useful :slight_smile:

Which module is the best to fork and start to implement :wink:

The ‘native wire protocol’ is HTTP :wink:


Kyoto Cabinet uses an RPC model called TSV-RPC, which is similar to
XML-RPC but uses TSV rather than XML. Although TSV is inferior to XML in
terms of expressive ability, TSV is superior to XML in terms of
simplicity, space efficiency, and processing effectiveness.

Cheers

On Tue, Mar 27, 2012 at 4:28 AM, Aleksandar L. [email protected]
wrote:

Due to the fact that Kyoto Tycoon can speak memcache I think it should be
possible to use Kyoto Tycoon also direct with

memcache module.

And also the lua-resty-memcached library based on ngx_lua’s cosocket
API:

https://github.com/agentzh/lua-resty-memcached

But I’m fraid the functionalities exposed by KT’s memcached interface
are a little limited, a Lua binding for KT’s native wire protocol
based on ngx_lua’s cosocket may still be useful :slight_smile:

Best,
-agentzh

On Tue, Mar 27, 2012 at 8:25 PM, Aleksandar L. [email protected]
wrote:

Which module is the best to fork and start to implement :wink:

agentzh (Yichun Zhang) · GitHub

The ‘native wire protocol’ is HTTP :wink:

Fundamental Specifications of Kyoto Tycoon Version 1

Oh, then we need a library named lua-resty-http then :slight_smile: Just check out
how lua-resty-memcached and lua-resty-redis are implemented.

And here’s a (extremely) naive http 1.0 client implemented atop
cosocket:

https://groups.google.com/group/openresty/browse_thread/thread/55a3461e633bbf10

Best,
-agentzh

On Wed, Mar 28, 2012 at 3:44 AM, Aleksandar L. [email protected]
wrote:

Can I use

LuaSocket: Network support for the Lua language

No :slight_smile:

or is this blocking, I think so?!

LuaSocket will be blocking in the context of ngx_lua.

But ngx_lua’s cosocket API is intentionally designed to be compatible
with the LuaSocket API (and also with some useful functionality
additions). See

Best regards,
-agentzh

On 27-03-2012 16:14, agentzh wrote:

Oh, then we need a library named lua-resty-http then :slight_smile: Just check
out
how lua-resty-memcached and lua-resty-redis are implemented.

Can I use

or is this blocking, I think so?!

br Aleks