Issue a subrequest from a timer handler
Peter Leonov
gojpeg at gmail.com
Mon May 17 01:24:12 MSD 2010
Hello Piotr,
Thanks for a fast reply!
On 17.05.2010, at 0:08, "Piotr Sikora" <piotr.sikora at frickle.com> wrote:
> Hi,
>
>> If a subrequest is issued from timer nginx doesn't know about it
>> until the request is somehow accessed from the network. Otherwise
>> the subrequest stays stuck forever.
>
> Do I understand correctly, that you're starting subrequest without
> parent request?
My bad, tried to be short :)
There is a request, main request in terms of nginx. It is passed to a
module and the module desides to set a timer. A separated timer in the
module context structure, neither on the request read nor the write
event struct. The module handler returns (after r->main->count++ of
course) and we are left waiting for the timer.
Time passes and finally the request timer fires. In the timer handler
the subrequest is issued. And here comes tge troubles :)
The subrequest stays frozen if it just a struct in memory and nginx
doesn't know about it. But, on the main request connection timeout the
request comes to life and nginx process it correctly (as far as I can
tell).
>
>> How may a module signal nginx about a new subrequest to process?
>
> Do you mean signal nginx that:
> a) it's time to start subrequest?
> or
> b) response from subrequest arrived?
The a) variant is most close.
The module mentioned above can issue a subrequest and get its content
already. But only from the handler in the content phase, not from the
naked timer handler.
Best regards,
Peter.
More information about the nginx-devel
mailing list