mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-01 22:48:25 +00:00
BUG/MINOR: stream: fix tv_request calculation for applets
When the stats code was moved to an applet, it wasn't completely cleaned of its usage of the HTTP transaction and it used to store the HTTP status in txn->status and to set the HTTP request date to <now> from within the applet. This is totally wrong because the applet is seen as a server from the HTTP engine, which parses its response, so the http_txn must not be touched there. This was made visible by the cache which would always exhibit a negative TR log, indicating that nowhere in the code we took care of setting s->logs.tv_request while the code above used to continue to hide this. Another side effect of this issue is that under load, if the stats applet call risks to be delayed, the reported t_queue can appear negative by being below tv_request-tv_accept. This patch removes the assignment of tv_request and txn->status from the applet code and instead sets the tv_request if still unset when connecting to the applet. This ensures that all applets report correct request timers now.
This commit is contained in:
parent
ff3a41eb3f
commit
ee8269e84d
@ -2952,9 +2952,6 @@ static int stats_send_http_headers(struct stream_interface *si)
|
||||
else
|
||||
chunk_appendf(&trash, "\r\n");
|
||||
|
||||
s->txn->status = 200;
|
||||
s->logs.tv_request = now;
|
||||
|
||||
if (ci_putchk(si_ic(si), &trash) == -1) {
|
||||
si_applet_cant_put(si);
|
||||
return 0;
|
||||
@ -3000,9 +2997,6 @@ static int stats_send_http_redirect(struct stream_interface *si)
|
||||
(appctx->ctx.stats.flags & STAT_NO_REFRESH) ? ";norefresh" : "",
|
||||
scope_txt);
|
||||
|
||||
s->txn->status = 303;
|
||||
s->logs.tv_request = now;
|
||||
|
||||
if (ci_putchk(si_ic(si), &trash) == -1) {
|
||||
si_applet_cant_put(si);
|
||||
return 0;
|
||||
|
@ -1072,6 +1072,8 @@ static void sess_prepare_conn_req(struct stream *s)
|
||||
return;
|
||||
}
|
||||
|
||||
if (tv_iszero(&s->logs.tv_request))
|
||||
s->logs.tv_request = now;
|
||||
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
||||
si->state = SI_ST_EST;
|
||||
si->err_type = SI_ET_NONE;
|
||||
|
Loading…
Reference in New Issue
Block a user