Hi,
Lua-nginx-module 0.16RC2
Nginx 0.8.54
my nginx.conf :
location =/down2 {
content_by_lua_file “conf/lua_test.lua”;
}
and lua_test.lua:
local res = ngx.location.capture(‘/somepath’)
– do something for res
ngx.exec(“/down/pathXXX”) – File content is “ABC”
then , If I use command:
curl localhost/down2
#print out ABC
if I use Firefox to visit URL “http://localhost/down/pathXXX” and then
“ABC”
show out.
BUT , if I use ab to test it :
ab -v http://localhost/down2
#Fail with timeout
Log of ab:
Benchmarking localhost (be patient)…INFO: POST header ==
GET /down2 HTTP/1.0
Host: localhost
User-Agent: ApacheBench/2.3
Accept: /
LOG: header received:
HTTP/1.1 200 OK
Server: nginx/0.8.54
Date: Tue, 15 Mar 2011 07:22:30 GMT
Content-Type: text/plain
Content-Length: 10
Last-Modified: Fri, 11 Mar 2011 09:32:28 GMT
Connection: close
Accept-Ranges: bytes
I am Best
LOG: Response code = 200
apr_poll: The timeout specified has expired (70007)
I think lua-nginx-module lose some 0x0A 0x0D in resp.
Thanks,
Wendal C.
http://myblog.sunfarms.net
On Tue, Mar 15, 2011 at 3:26 PM, Wendal C. [email protected]
wrote:
Hi,
Lua-nginx-module 0.16RC2
Nginx 0.8.54
[snip]
I am Best
LOG: Response code = 200
apr_poll: The timeout specified has expired (70007)
Can you provide a minimized but complete example to help us reproduce
this issue?
I do not understand where the output “I am Best” came from in your
sample, for example.
And in particular, what exactly were you doing in “-- do something for
res” ?
I think lua-nginx-module lose some 0x0A 0x0D in resp.
Where does “0x0A 0x0D” come from?
Cheers,
-agentzh
2011/3/17 agentzh [email protected]:
because older nginx does not use reference counting.
I’ll attempt fix in the next few days. Thank you for reporting this
and sorry about this issue 
Sorry for the delay. I’ve caught a really bad cold recently 
The good news is that I’ve just fixed this issue in ngx_lua’s git HEAD:
https://github.com/chaoslawful/lua-nginx-module
Alternatively, you can try out the new release candidate tarball,
which also includes this fix:
https://github.com/chaoslawful/lua-nginx-module/tarball/v0.1.6rc4
Please let me know if it works for you 
Have fun!
-agentzh
nginx.conf
location /test {
root html;
content_by_lua_file “conf/test.lua”;
}
test.lua:
– start
ngx.location.capture(‘/1.html’)
ngx.exec(“/1.html”)
– end
Files in folder :
nginx
– conf
– nginx.conf
– test.lua
– html
– 1.html
That is all
#用中文再说一遍,英语水平有限:
我得到的最小集合就是:
-
nginx.conf
location /test {
root html;
content_by_lua_file “conf/test.lua”;
}
server/http等配置按默认的, event module用的是 epoll
-
test.lua文件仅2行:
ngx.location.capture(‘/1.html’)
ngx.exec(“/1.html”)
我尝试过,无论这两句话是否请求同一个文件,结果都一样.
- 1.html文件里面仅有几个字母,我已经试过不同的文件大小,结果一样
我遇到的情况是这样的:
- 通过wget/curl/Firefox来访问 localhost/test 都能正常显示1.html中的内容
- 使用ab访问 localhost/1.html是正常的,能够pass
- 使用ab进行测试,总是timeout , 我使用的语句是 ab -v 5 localhost/test
Benchmarking localhost (be patient)…INFO: POST header ==
GET /down2 HTTP/1.0
Host: localhost
User-Agent: ApacheBench/2.3
Accept: /
LOG: header received:
HTTP/1.1 200 OK
Server: nginx/0.8.54
Date: Tue, 15 Mar 2011 07:22:30 GMT
Content-Type: text/plain
Content-Length: 4
Last-Modified: Fri, 11 Mar 2011 09:32:28 GMT
Connection: close
Accept-Ranges: bytes
ABC
LOG: Response code = 200
apr_poll: The timeout specified has expired (70007)
其中的ABC就是1.html的内容, 非常抱歉我之前写错了.
对于0A0D的描述,仅仅是我的猜测,请无视之.
单独写 ngx.exec(“/1.html”) 也是能够通过ab测试的.
环境:
Ubuntu 10.10
Luajit-5.1-dev
Nginx 0.8.54
Lua-nginx-module 0.16rc2
Thanks,
Wendal C.
2011/3/15 agentzh [email protected]
Great ! It works!!
Thank you for your help!!!
2011/4/7 agentzh [email protected]