request hangs

agentzh agentzh at
Mon Feb 28 10:50:28 MSK 2011

On Mon, Feb 28, 2011 at 2:33 PM, magz <nginx-forum at> wrote:
> magz Wrote:
> -------------------------------------------------------
>> Hi,
>> I have strange problem with main request  hand if
>> I call for sub-request.  Maybe somebody can help
>> me with it?

Which version of nginx are you using?

If you're using nginx 0.8.x and above, the symptom suggests you didn't
get r->main->count right. Use --with-debug while building your nginx,
and track the values of r->main->count.

For example, in the following line of my local error.log,

    2011/01/28 13:01:50 [debug] 1199#0: *1 http finalize request: -4,
"/main?" a:0, c:3

a:0 means the current request is not the active request at the moment
(i.e., r != r->connection->data), and c:3 means r->main->count is 3.
The request can only be successfully finalized unless it is the
current active request. Also, the main request won't terminate, i.e.,
will hang if the r->main->count counter is not going to be decremented
to zero. Well, r->main->count is just a reference counter for the main
request object. A simple way of doing poors' "garbage collection",
well, at least kind of.

When doing subrequest programming on the C level, one should be VERY
VERY careful with these two values, among other things :)


More information about the nginx mailing list