[MINOR] Add down termination condition

If a connection is closed by because the backend became unavailable
then log 'D' as the termination condition.

Signed-off-by: Simon Horman <horms@verge.net.au>
This commit is contained in:
Simon Horman 2011-06-21 14:34:59 +09:00 committed by Willy Tarreau
parent e0d1bfb4c1
commit 752dc4ab2d
4 changed files with 11 additions and 5 deletions

View File

@ -8725,6 +8725,9 @@ each of which has a special meaning :
would be wise to preventively restart the process after such an
event too, in case it would be caused by memory corruption.
D : the session was killed by haproxy because the server was detected
as down and was configured to kill all connections when going down.
c : the client-side timeout expired while waiting for the client to
send or receive data.

View File

@ -65,9 +65,9 @@
#define SN_ERR_PRXCOND 0x00005000 /* the proxy decided to close (deny...) */
#define SN_ERR_RESOURCE 0x00006000 /* the proxy encountered a lack of a local resources (fd, mem, ...) */
#define SN_ERR_INTERNAL 0x00007000 /* the proxy encountered an internal error */
#define SN_ERR_MASK 0x00007000 /* mask to get only session error flags */
#define SN_ERR_DOWN 0x00008000 /* the proxy killed a session because the backend became unavailable */
#define SN_ERR_MASK 0x0000f000 /* mask to get only session error flags */
#define SN_ERR_SHIFT 12 /* bit shift */
#define SN_BE_TRACK_SC1 0x00008000 /* backend tracks stick-counter 1 */
/* session state at termination, bits values 0x10000 to 0x70000 (0-7 shift 16) */
#define SN_FINST_R 0x00010000 /* session ended during client request */
@ -79,9 +79,10 @@
#define SN_FINST_T 0x00070000 /* session ended tarpitted */
#define SN_FINST_MASK 0x00070000 /* mask to get only final session state flags */
#define SN_FINST_SHIFT 16 /* bit shift */
#define SN_BE_TRACK_SC2 0x00080000 /* backend tracks stick-counter 2 */
#define SN_IGNORE_PRST 0x00100000 /* ignore persistence */
#define SN_IGNORE_PRST 0x00080000 /* ignore persistence */
#define SN_BE_TRACK_SC1 0x00100000 /* backend tracks stick-counter 1 */
#define SN_BE_TRACK_SC2 0x00200000 /* backend tracks stick-counter 2 */
/* Termination sequence tracing.
*

View File

@ -371,6 +371,8 @@ static void shutdown_sessions(struct server *srv)
buffer_shutw_now(session->req);
buffer_shutr_now(session->rep);
session->task->nice = 1024;
if (!(session->flags & SN_ERR_MASK))
session->flags |= SN_ERR_DOWN;
task_wakeup(session->task, TASK_WOKEN_OTHER);
}
}

View File

@ -52,7 +52,7 @@ const char *monthname[12] = {
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
const char sess_term_cond[8] = "-cCsSPRI"; /* normal, CliTo, CliErr, SrvTo, SrvErr, PxErr, Resource, Internal */
const char sess_term_cond[9] = "-cCsSPRID"; /* normal, CliTo, CliErr, SrvTo, SrvErr, PxErr, Resource, Internal, Down */
const char sess_fin_state[8] = "-RCHDLQT"; /* cliRequest, srvConnect, srvHeader, Data, Last, Queue, Tarpit */
/*