close" line to the HTTP response, or by sending a GOAWAY frame in case of
HTTP2. When this option is set, connection closing will be spread over this
set <time>.
+ If the close-spread-time is set to "infinite", active connection closing
+ during a soft-stop will be disabled. The "Connection: close" header will not
+ be added to HTTP responses (or GOAWAY for HTTP2) anymore and idle connections
+ will only be closed once their timeout is reached (based on the various
+ timeouts set in the configuration).
Arguments :
<time> is a time window (by default in milliseconds) during which
- connection closing will be spread during a soft-stop operation.
+ connection closing will be spread during a soft-stop operation, or
+ "infinite" if active connection closing should be disabled.
It is recommended to set this setting to a value lower than the one used in
the "hard-stop-after" option if this one is used, so that all connections
have a chance to gracefully close before the process stops.
- See also: grace, hard-stop-after
+ See also: grace, hard-stop-after, idle-close-on-response
cpu-map [auto:]<process-set>[/<thread-set>] <cpu-set>...
On some operating systems, it is possible to bind a process or a thread to a
#define GTUNE_SCHED_LOW_LATENCY (1<<19)
#define GTUNE_IDLE_POOL_SHARED (1<<20)
#define GTUNE_DISABLE_H2_WEBSOCKET (1<<21)
+#define GTUNE_DISABLE_ACTIVE_CLOSE (1<<22)
/* SSL server verify mode */
enum {
}
/* If KAL, check if the frontend is stopping. If yes, switch in CLO mode
- * unless a 'close-spread-time' option is set.
+ * unless a 'close-spread-time' option is set (either to define a
+ * soft-close window or to disable active closing (close-spread-time
+ * option set to 0).
*/
if (h1s->flags & H1S_F_WANT_KAL && (fe->flags & (PR_FL_DISABLED|PR_FL_STOPPED))) {
int want_clo = 1;
want_clo = (remaining_window <= statistical_prng_range(global.close_spread_time));
}
}
+ else if (global.tune.options & GTUNE_DISABLE_ACTIVE_CLOSE)
+ want_clo = 0;
if (want_clo) {
h1s->flags = (h1s->flags & ~H1S_F_WANT_MSK) | H1S_F_WANT_CLO;
send_close = (remaining_window <= statistical_prng_range(global.close_spread_time));
}
}
+ else if (global.tune.options & GTUNE_DISABLE_ACTIVE_CLOSE)
+ send_close = 0; /* let the client close his connection himself */
if (send_close)
goto release;
}
send_goaway = (remaining_window <= statistical_prng_range(global.close_spread_time));
}
}
+ else if (global.tune.options & GTUNE_DISABLE_ACTIVE_CLOSE)
+ send_goaway = 0; /* let the client close his connection himself */
/* frontend is stopping, reload likely in progress, let's try
* to announce a graceful shutdown if not yet done. We don't
* care if it fails, it will be tried again later.
memprintf(err, "'%s' expects <time> as argument.\n", args[0]);
return -1;
}
+
+ /* If close-spread-time is set to "infinite", disable the active connection
+ * closing during soft-stop.
+ */
+ if (strcmp(args[1], "infinite") == 0) {
+ global.tune.options |= GTUNE_DISABLE_ACTIVE_CLOSE;
+ global.close_spread_time = TICK_ETERNITY;
+ return 0;
+ }
+
res = parse_time_err(args[1], &global.close_spread_time, TIME_UNIT_MS);
if (res == PARSE_TIME_OVER) {
memprintf(err, "timer overflow in argument '%s' to '%s' (maximum value is 2147483647 ms or ~24.8 days)",
memprintf(err, "unexpected character '%c' in argument to <%s>.\n", *res, args[0]);
return -1;
}
+ global.tune.options &= ~GTUNE_DISABLE_ACTIVE_CLOSE;
+
return 0;
}