Clean up state machine.
authorAlan T. DeKok <aland@freeradius.org>
Sun, 29 Nov 2009 15:07:23 +0000 (16:07 +0100)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 29 Nov 2009 15:07:23 +0000 (16:07 +0100)
commitd7b4f003477644978f3fefa694305dce9b5dc8bf
treef935bd3e39dae24c806732b02f1611ac2cede81f
parent60dae40f9f9eec6a09c58c53cd7180a757c5590e
Clean up state machine.

  This error happens when "max_request_time" is set VERY low.
i.e. lower than "response_window".  (12s versus 30s).

  The current logic for enforcing the various timers is pretty bad.  There
is one timer per request, and it bounces around between the different
requirements.  At the time it was written, it seemed simpler than trying
to manage 3-4 simultaneous timers per request.

  When the request is proxied, the timer being applied is for
"response_window".  BUT by the time that expires, the "max_request_time"
has expired.  The code *does* notice that it has expired.  BUT it doesn't
notice that there's no child thread processing the request.  So it waits
for the child thread to exit... forever.

  At some point, a timer overflows, and it dies.

  There are a few changes to make:

1) check for "no child" in this situation, and clean up the request rather
  than waiting forever.

2) cap the timer to 5 minutes (this can still happen, for example, when a
   bad DB locks a thread for hours at a time).

3) don't overflow when adding timer values.
src/main/event.c