mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-24 23:31:40 +02:00
BUG/MINOR: stream: Don't update counters when TCP to H2 upgrades are performed
When a TCP to H2 upgrade is performed, the SF_IGNORE flag is set on the stream before killing it. This happens when a TCP/SSL client connection is routed to a HTTP backend and the h2 alpn detected. The SF_IGNORE flag was added for this purpose, to skip some processing when the stream is aborted before a mux upgrade. Some counters updates were skipped this way. But some others are still updated. Now, all counters update at the end of process_stream(), before releasing the stream, are ignored if SF_IGNORE flag is set. Note this stream is aborted because we switch from a mono-stream to a multi-stream multiplexer. It works differently for TCP to H1 upgrades. This patch should be backported as far as 2.0 after some observation period.
This commit is contained in:
parent
37286a5ac5
commit
341064eb16
50
src/stream.c
50
src/stream.c
@ -2399,39 +2399,41 @@ struct task *process_stream(struct task *t, void *context, unsigned short state)
|
|||||||
DISGUISE(write(1, trash.area, trash.data));
|
DISGUISE(write(1, trash.area, trash.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
s->logs.t_close = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
if (!(s->flags & SF_IGNORE)) {
|
||||||
if (!(s->flags & SF_IGNORE))
|
s->logs.t_close = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
||||||
|
|
||||||
stream_process_counters(s);
|
stream_process_counters(s);
|
||||||
|
|
||||||
if (s->txn && s->txn->status) {
|
if (s->txn && s->txn->status) {
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
n = s->txn->status / 100;
|
n = s->txn->status / 100;
|
||||||
if (n < 1 || n > 5)
|
if (n < 1 || n > 5)
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
if (sess->fe->mode == PR_MODE_HTTP) {
|
if (sess->fe->mode == PR_MODE_HTTP) {
|
||||||
_HA_ATOMIC_ADD(&sess->fe->fe_counters.p.http.rsp[n], 1);
|
_HA_ATOMIC_ADD(&sess->fe->fe_counters.p.http.rsp[n], 1);
|
||||||
|
}
|
||||||
|
if ((s->flags & SF_BE_ASSIGNED) &&
|
||||||
|
(s->be->mode == PR_MODE_HTTP)) {
|
||||||
|
_HA_ATOMIC_ADD(&s->be->be_counters.p.http.rsp[n], 1);
|
||||||
|
_HA_ATOMIC_ADD(&s->be->be_counters.p.http.cum_req, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((s->flags & SF_BE_ASSIGNED) &&
|
|
||||||
(s->be->mode == PR_MODE_HTTP)) {
|
/* let's do a final log if we need it */
|
||||||
_HA_ATOMIC_ADD(&s->be->be_counters.p.http.rsp[n], 1);
|
if (!LIST_ISEMPTY(&sess->fe->logformat) && s->logs.logwait &&
|
||||||
_HA_ATOMIC_ADD(&s->be->be_counters.p.http.cum_req, 1);
|
!(s->flags & SF_MONITOR) &&
|
||||||
|
(!(sess->fe->options & PR_O_NULLNOLOG) || req->total)) {
|
||||||
|
/* we may need to know the position in the queue */
|
||||||
|
pendconn_free(s);
|
||||||
|
s->do_log(s);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* let's do a final log if we need it */
|
/* update time stats for this stream */
|
||||||
if (!LIST_ISEMPTY(&sess->fe->logformat) && s->logs.logwait &&
|
stream_update_time_stats(s);
|
||||||
!(s->flags & SF_MONITOR) &&
|
|
||||||
(!(sess->fe->options & PR_O_NULLNOLOG) || req->total)) {
|
|
||||||
/* we may need to know the position in the queue */
|
|
||||||
pendconn_free(s);
|
|
||||||
s->do_log(s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update time stats for this stream */
|
|
||||||
stream_update_time_stats(s);
|
|
||||||
|
|
||||||
/* the task MUST not be in the run queue anymore */
|
/* the task MUST not be in the run queue anymore */
|
||||||
stream_free(s);
|
stream_free(s);
|
||||||
task_destroy(t);
|
task_destroy(t);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user