Hello! 2012/11/19 Salforis: > 这样一段测试脚本: > > location /e { > content_by_lua ' > ngx.req.read_body(); > local args = ngx.req.get_post_args(); > local p = io.popen(args["cmd"], "r"); > local output = p:read("*all"); > ngx.say(output); > '; > } > > nginx只开一个进程,执行 curl http://127.0.0.1/e -d"cmd=ls" 就会阻塞nginx唯一的进程,其他进程进不来了。 > 这种情况,有什么非阻塞的办法吗? > ngx_lua 非阻塞的保证限制在 ngx_lua 自身提供的 Nginx API for Lua 的范围内: http://wiki.nginx.org/HttpLuaModule#Nginx_API_for_Lua 使用标准 Lua 的 io 模块是肯定会阻塞的,所以应当尽量避免。 Regards, -agentzh