[ANN] ngx_openresty devel version 1.2.4.7 released

131 views
Skip to first unread message

agentzh

unread,
Nov 11, 2012, 11:40:03 PM11/11/12
to ng...@nginx.org, openresty, openresty-en
Hello!

I am happy to announce the new development version of ngx_openresty,
1.2.4.7:

http://openresty.org/#Download

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
(devel) release, 1.2.4.5:

* upgraded LuaJIT to 2.0.0rc3.

* upgraded LuaNginxModule to 0.7.4.

* feature: added new directive lua_check_client_abort (default
to "off") for monitoring and processing the event that the
client closes the (downstream) connection prematurely.
thanks Zhu Dejiang for request this feature.

* feature: added new Lua API ngx.on_abort() which is used to
register user Lua function callback for the event that the
client closes the (downstream) connection prematurely.
thanks Matthieu Tourne for suggesting this feature.

* feature: ngx.exit(N) can now abort pending subrequests when
"N = 408" (request time out) or "N = 499" (client closed
request) or "N = -1" (error).

* bugfix: The TCP/stream cosocket's connect() method could not
detect errors like "connection refused" when kqueue was used
(on FreeBSD or Mac OS X, for example). thanks smallfish for
reporting this issue.

* bugfix: reading operations on ngx.req.socket() did not
return any errors when the request body got truncated; now
we return the "client aborted" error.

* upgraded LuaRestyDNSLibrary to 0.09.

* refactor: avoided using "package.seeall" in Lua module
definitions, which improves performance and also prevents
subtle bad side-effects.

* bugfix: a debugging output might be sent to stdout
unexpectedly in some code path.

* upgraded LuaRestyMemcachedLibrary to 0.10.

* refactor: avoided using "package.seeall" in Lua module
definitions, which improves performance and also prevents
subtle bad side-effects.

* docs: fixed typos in README. thanks cyberty for the patch.

* upgraded LuaRestyRedisLibrary to 0.15.

* refactor: avoided using "package.seeall" in Lua module
definitions, which improves performance and also prevents
subtle bad side-effects.

* optimize: avoided using "ipairs()" which is slower than
plain "for i=1,N" loops.

* upgraded LuaRestyMySQLLibrary to 0.11.

* refactor: avoided using "package.seeall" in Lua module
definitions, which improves performance and also prevents
subtle bad side-effects.

* feature: now the new() method will return a string
describing the error as the second return value in case of
failures.

* upgraded LuaRestyUploadLibrary to 0.04.

* refactor: avoided using "package.seeall" in Lua module
definitions, which improves performance and also prevents
subtle bad side-effects.

* upgraded LuaRestyStringLibrary to 0.07.

* refactor: avoided using "package.seeall" in Lua module
definitions, which improves performance and also prevents
subtle bad side-effects.

* docs: typo-fixes in the code samples from Bearnard Hibbins.

* bugfix: Nginx upstream modules could not detect the "connection
refused" error in time if kqueue was used; now we apply the
upstream_test_connect_kqueue patch for the Nginx core.

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

http://openresty.org/#ChangeLog1002004

OpenResty (aka. ngx_openresty) is a full-fledged web application server by
bundling the standard Nginx core, lots of 3rd-party Nginx modules and Lua
libraries, as well as most of their external dependencies. See OpenResty's
homepage for details:

http://openresty.org/

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:

http://qa.openresty.org

Have fun!
-agentzh

lhmwzy

unread,
Nov 12, 2012, 1:01:51 AM11/12/12
to open...@googlegroups.com
在FreeBSD上编译的时候,出现下列警告
CC        lj_snap.o
lj_snap.c: In function 'snap_restoredata':
lj_snap.c:654: warning: dereferencing type-punned pointer will break strict-aliasing rules
lj_snap.c:665: warning: dereferencing type-punned pointer will break strict-aliasing rules
lj_snap.c: In function 'snap_restoredata':
lj_snap.c:654: warning: dereferencing type-punned pointer will break strict-aliasing rules
lj_snap.c:665: warning: dereferencing type-punned pointer will break strict-aliasing rules
CC        lj_record.o


#uname -a:
FreeBSD xxx.com 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011     ro...@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64


2012/11/12 agentzh <age...@gmail.com>
-agentzh

--
邮件自: 列表“openresty”,专用于技术讨论!
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
详情: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
建议: 提问的智慧 http://wiki.woodpecker.org.cn/moin/AskForHelp
教程: http://agentzh.org/misc/nginx/agentzh-nginx-tutorials-zhcn.html

James Hurst

unread,
Nov 12, 2012, 11:57:37 AM11/12/12
to open...@googlegroups.com
Great stuff! Good to see the "abort" related features.

refactor: avoided using "package.seeall" in Lua module 
definitions, which improves performance and also prevents
subtle bad side-effects.

Could you elaborate on this at all? Just curious about the rationale, and whether other user-land modules should follow the convention?

James.
 

-agentzh




--
James Hurst
+44 (0) 7979 817 702 | @pintsized

River Rat Records
Politi Arts, 10 Manor Road, London, N16 5SA
www.riverratrecords.com | @riverratrecords

agentzh

unread,
Nov 12, 2012, 2:04:34 PM11/12/12
to open...@googlegroups.com
Hello!

On Mon, Nov 12, 2012 at 8:57 AM, James Hurst wrote:
> Great stuff! Good to see the "abort" related features.
>

Glad you like it :)

>> refactor: avoided using "package.seeall" in Lua module
>>
>> definitions, which improves performance and also prevents
>> subtle bad side-effects.
>
> Could you elaborate on this at all? Just curious about the rationale,
>

The "package.seeall" flag makes the global environment of the first
request that does require() attach to the Lua module's environment via
the __index metamethod, which could result in the following bad
things:

1. This request's global environment table is thus leaked by this way.

2. Because OO-style Lua modules usually make the module table attach
to every object instance via __index, thus everything in the first
request's environment table is also visible to every object instance.

3. The require() built-in has the side-effect of setting an entry in
the current global environment (for example, require "foo" will set
the global variable "foo" at the same time), which adds pollution to
the module's environment and also every Lua OO instance's field space
(if any).

4. Removing "package.seeall" also encourages local-izing the Lua
builtins (like pairs, unpack, and etc) used in the Lua module scope,
making LuaJIT and Lua 5.1 generate more optimal code.

> and
> whether other user-land modules should follow the convention?

Well, this is not mandatory; but I strongly recommend it.

Also, I *strongly* recommend adding the following code snippet to the
end of every Lua module:

local class_mt = {
-- to prevent use of casual module global variables
__newindex = function (table, key, val)
error('attempt to write to undeclared variable "' .. key .. '"')
end
}
setmetatable(_M, class_mt)

This metamethod can prevent casual data sharing via (undeclared)
module-level variables among requests (which can be a disaster,
because concurrent requests can *see* each other's data by accident
under load).

Best regards,
-agentzh

bigplum

unread,
Nov 10, 2016, 10:09:55 PM11/10/16
to openresty
Hello, 

It seems that ngx.xxx() method could not be used in the module without "package.seeall".

It shows:   attempt to index global 'ngx' (a nil value)

Is there some tricks to use ngx.xxx() , when we use module() to package a module?
Reply all
Reply to author
Forward
0 new messages