Ngx_openresty devel version released

Hello, folks!

After more than one month’s hacking, I am happy to announce the new
development version of ngx_openresty,

OpenResty® - Open source

Special thanks go to all our contributors and users for helping make
this happen!

Below is the complete change log for this release, as compared to the
last (development) release,

  • upgraded LuaNginxModule to 0.6.7.

    • feature: implemented the shdict:flush_expired(max_count?)
      method for flushing out and removing expired items up to
      “max_count” (or unlimited when “max_count == 0”). thanks
      Brian A. for the patch.

    • optimize: tcpsock:send() now calls “c->send()” instead of
      “ngx_output_chain()”, which gives about 4% ~ 5% performance
      boost for a simple test case accessing Redis for several

    • optimize: we now skip processing in the default write event
      handler when the write event is not ready.

    • refactor: the I/O scheduler has been rewritten to keep track
      of the coroutine associated with each (non-blocking) I/O
      operation automatically, which paves a way to the upcoming
      “ngx.thread” API (aka the “lightweight thread” API).

    • refactor: now we use a new Nginx subrequest model that
      bypasses “ngx_http_postpone_filter_module” completely, which
      paves a way for arbitrary order of outputting among
      subrequests and their parents when the “ngx.thread API”
      lands in the near future.

    • bugfix: the “http finalize non-active request” alerts might
      happen when subrequests were used. thanks Lance Li for
      reporting this issue.

    • bugfix: reset the subrequest status code when the
      “ngx_http_upstream” request in the subrequest fails due to
      timeout errors or premature connection close and etc. this
      fix also requires the nonbuffered-upstream-truncation patch
      for the Nginx core to cancel a limitation in

    • bugfix: fixed the gcc error “-Werror=strict-aliasing” in the
      Lua/LuaJIT bytecode loader when “-O2” or above is used.
      thanks jinglong for the patch.

    • bugfix: the main request might be prematurely terminated if
      a subrequest issued by ngx.location.capture (or its friends)
      was finalized with error codes.

    • bugfix: the Nginx built-in resolver might not be destroyed
      in time when it was used by ngx.socket.tcp and

    • bugfix: coroutine.status() returned “suspended” for “normal”

    • bugfix: coroutine.resume() did not return an error
      immediately when operating on “normal” coroutines.

    • bugfix: when the entry coroutine was yielded by
      coroutine.yield() then after it was resumed automatically
      its status would still be “suspended”.

    • bugfix: the write event timer might not be removed in time
      in ngx.flush(true) when “ngx_handle_write_event” failed.

    • bugfix: always remove the read event timer during downstream
      cosocket finalization if it is not removed yet.

    • bugfix: ngx.flush(true) might not return immediately when it

    • bugfix: the “resume_handler” field of the subrequest “ctx”
      was not properly initialized.

    • feature: added new dtrace static probes
      “http-lua-user-coroutine-yield” and

    • docs: fixed the documentation for ngx.req.set_header and
      made it clear that the modified request headers will be
      inherited by the subrequests by default. thanks James Hurst
      for reporting this issue.

    • docs: documented the trick for doing background asynchronous
      jobs by using ngx.eof() + “keepalive_timeout 0”. thanks
      Lance Li for the suggestion.

  • upgraded LuaRedisParserLibrary to 0.10.

    • bugfix: Lua stack overflow would happen when too many Redis
      arguments were passed into the build_query method. thanks
      Guo Yin for reporting this issue.
  • upgraded LuaRestyDNSLibrary to 0.08.

    • feature: added new method tcp_query to enforce pure TCP
      transportation for the DNS queries.

    • feature: added support for TCP retries when the UDP reply
      gets truncated.

    • feature: added support for “PTR” queries and records.

    • feature: added support for “TXT” queries and records.

    • feature: added support for “NS” queries and records.

    • bugfix: the udp resolver did not discard DNS replies with
      unmatched IDs for 128 times as originally designed.

  • upgraded LuaRestyRedisLibrary to 0.14.

    • optimize: now we do the string concatenation for Redis
      queries on the Lua land instead of on the C land, which
      gives 6% ~ 7% over-all performance boost when using LuaJIT
      2.0 beta10.

    • docs: fixed a typo in the sample code. thanks xingxing for
      reporting it.

  • upgraded LuaRestyMemcachedLibrary to 0.08.

    • feature: added new option “key_transform” to the new method
      to allow the user to override the default escaping and
      unescaping methods for Memcached keys. thanks Matthieu
      Tourne for the patch.

    • bugfix: now the new method will return a string describing
      the error as the second return value in case of failures.

    • docs: added more documentation for the set_keepalive method.

    • docs: documented that this library cannot be used in those
      contexts where the LuaNginxModule cosocket API is

    • docs: documented that storing the object instance into Lua
      module-level variables will result in failures for
      concurrent requests.

  • upgraded SrcacheNginxModule to 0.16.

    • bugfix: srcache_fetch would use truncated responses from
      MemcNginxModule or other upstream modules. this usually
      happened when the upstream read time expired or the upstream
      prematurely closed the connection. this fix also requires
      the nonbuffered-upsteram-truncation patch to cancel a
      limitation in the Nginx core. thanks Bryan Alger for
      reporting the issue.

    • bugfix: the main request response was not discarded by
      srcache_store when there was an error in the last minute
      (like a read-timeout error or premature connection close
      happens when “ngx_http_upstream” reads the upstream response
      body). this fix also requires the
      nonbuffered-upstream-truncation patch for the Nginx core to
      cancel a limitation in “ngx_http_upstream”.

    • bugfix: the main request might prematurely terminate if the
      srcache_store subrequest was finalized with error codes.

  • upgraded Redis2NginxModule to 0.09.

    • bugfix: directives redis2_query, redis2_literal_raw_query,
      and redis2_raw_queries could not be inherited automatically
      by the “location if” blocks, resulting in the “no redis2
      query specified or the query is empty” error. thanks Tomasz
      Prus for the patch.
  • feature: updated the dtrace patch to add new static probe

  • feature: updated the dtrace patch to include new tapset
    functions “ngx_indent”, “ngx_http_subreq_depth”, and

  • bugfix: added the nonbuffered-upstream-truncation patch for the
    Nginx core to make “ngx_http_upstream” provide a way in the
    context of a subrequest to signal the parent of errors when
    upstream data truncation happens. thanks Bryan Alger for
    reporting this issue. (This is a temporary solution and I’ll
    work on a new patch as per Maxim D.'s suggestions.)

  • bugfix: applied the channel-uninit-params patch for the Nginx
    core to fix Valgrind/Memcheck warnings about unitialized bytes
    in the parameters of “sendmsg”.

  • feature: updated the allow_request_body_updating patch to define

The HTML version of the change log with a lot of helpful hyper-links
can be browsed here:

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. See
OpenResty’s homepage for details:

We have been running extensive testing on our Amazon EC2 test cluster
and ensure that all the components (including the Nginx core) play
well together. The latest test report can always be found here:

Have fun!