access_by_lua_block {
local sum = 0
for i = 1, 1.0e7 do
sum = sum + i
end
}
and proxy mode. When test with relatively large number of concurrency(10k, long live, hang up after first request), 502 response is observed.
error.log
reports that:
upstream prematurely closed connection while reading response header from upstream
I started from non-trivial code, reduced its complexity and finally I realize that bare simple calculating code would cause the same syndrome. (and if we remove the code, the problem disapears)
I wonder if it's because we should not put heavy logic into access_by_lua, or there's some configuration I should check.