The last debug log.
2015/06/14 05:29:34 [debug] 4393#0: *251 event timer del: 22: 1434227394524
2015/06/14 05:29:34 [debug] 4393#0: *251 http upstream request: "/fuga?"
2015/06/14 05:29:34 [debug] 4393#0: *251 http upstream dummy handler
2015/06/14 05:29:34 [debug] 4393#0: *251 http upstream request: "/fuga?"
2015/06/14 05:29:34 [debug] 4393#0: *251 http upstream process upstream
2015/06/14 05:29:34 [debug] 4393#0: *251 pipe read upstream: 1
2015/06/14 05:29:34 [debug] 4393#0: *251 no pipe bufs to read in
2015/06/14 05:29:34 [debug] 4393#0: *251 pipe buf in s:1 t:1 f:0 0000000000BD2930, pos 0000000000BD29CE, size: 3938 file: 0, size: 0
2015/06/14 05:29:34 [debug] 4393#0: *251 pipe buf in s:1 t:1 f:0 0000000000BD3940, pos 0000000000BD3940, size: 4096 file: 0, size: 0
2015/06/14 05:29:34 [debug] 4393#0: *251 pipe buf in s:1 t:1 f:0 0000000000BD4950, pos 0000000000BD4950, size: 4096 file: 0, size: 0
2015/06/14 05:29:34 [debug] 4393#0: *251 pipe buf in s:1 t:1 f:0 0000000000B94720, pos 0000000000B94720, size: 4096 file: 0, size: 0
2015/06/14 05:29:34 [debug] 4393#0: *251 pipe buf in s:1 t:1 f:0 0000000000B95730, pos 0000000000B95730, size: 4096 file: 0, size: 0
2015/06/14 05:29:34 [debug] 4393#0: *251 pipe buf in s:1 t:1 f:0 0000000000B96740, pos 0000000000B96740, size: 4096 file: 0, size: 0
2015/06/14 05:29:34 [debug] 4393#0: *251 pipe buf in s:1 t:1 f:0 0000000000B97750, pos 0000000000B97750, size: 4096 file: 0, size: 0
2015/06/14 05:29:34 [debug] 4393#0: *251 pipe buf in s:1 t:1 f:0 0000000000A6E5A0, pos 0000000000A6E5A0, size: 4096 file: 0, size: 0
2015/06/14 05:29:34 [debug] 4393#0: *251 pipe buf in s:1 t:1 f:0 0000000000A6F5B0, pos 0000000000A6F5B0, size: 4096 file: 0, size: 0
2015/06/14 05:29:34 [debug] 4393#0: *251 pipe length: 63294
2015/06/14 05:29:34 [debug] 4393#0: *251 http upstream request: "/fuga?"
2015/06/14 05:29:34 [debug] 4393#0: *251 http upstream dummy handler
I succeed in solving the problem.
I tried increasing proxy buffers, bad I misunderstood the location which should be change.
but I should have changed it at the endpoint which is requested by location.capture.
When I changed buffer size of the endpoint, the whole request succeeded.
However, a next question came to mind.
Why the request to "/hoge" using subrequest is hunged up
though the direct request to the endpoint "/fuga" is ok?
I read the source of nginx and lua-nginx-module using gdb, and I think the reason may be the below.
The direct request tries to use buffers firstly, but if buffer size is not enough, nginx read upstream response and write it to downstream with buffers sequentially.
But the subrequst has not the same context to the downstream of the first request, so nginx has no choice but to read upstream's whole response with buffers.
So debug log "no pipe bufs to read in" is printed.
Is the above reason is right?
Yusuke Enomoto
2015年6月13日土曜日 12時21分45秒 UTC+9 agentzh:
Hello!
On Fri, Jun 12, 2015 at 6:41 PM, Yusuke Enomoto wrote:
> Hello.
> lua location.capture method hungs up when upstream response size is a bit
> big. (90kb response causes this case)
> I tried to change many configuration and increase buffer sizes, but it
> doesn't solve the problem.
[...]
> How to solve the problem?
You didn't provide enough information for me to debug for you. Please
see the following document for details you should include:
http://openresty.org/faq.html#how-should-i-report-a-problem
> Changing configuration can solve?
I'm not sure at this point. See above.
> or Should I use socket API for
> no-buffering reading response?
You could though ngx.location.capture should work as long as you do
not disable proxy buffering.
But in general you're encouraged ot use cosockets for big responses
exceeding 1 MB.
> Do you think 100k is big response?
>
Not at all. ngx.location.capture works well with responses of many
many mega bytes in CloudFlare's production environment though we're
going to replace it with cosockets to reduce impact on the Lua/LuaJIT
GC.
Regards,
-agentzh