Commit 3a9681de authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

Revert "More work on refactoring req-cleanup"

This reverts commit 6233b088.

Conflicts:
	bin/varnishd/cache/cache_req.c

The conflict was introduced with the handling of h2 stream 0 pseudo
request: 51127b46. This fixes a
regression where timeout_idle could be circumvented by a periodic
CRLF, except that it has no real consequence like holding onto a
worker thread thanks to timeout_linger kicking in as expected.

In addition to reverting the change, test coverage is added.
parent f457cea3
......@@ -43,8 +43,8 @@
#include "vtim.h"
static void
req_AcctLogCharge(struct VSC_main_wrk *ds, struct req *req)
void
Req_AcctLogCharge(struct VSC_main_wrk *ds, struct req *req)
{
struct acct_req *a;
......@@ -165,7 +165,8 @@ Req_Release(struct req *req)
#include "tbl/acct_fields_req.h"
AZ(req->vcl);
AZ(req->vsl->wid);
if (req->vsl->wid)
VSL_End(req->vsl);
sp = req->sp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
pp = sp->pool;
......@@ -219,8 +220,8 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req)
VCL_Recache(wrk, &req->vcl);
/* Charge and log byte counters */
req_AcctLogCharge(wrk->stats, req);
if (req->vsl->wid) {
Req_AcctLogCharge(wrk->stats, req);
if (req->vsl->wid != sp->vxid)
VSL_End(req->vsl);
else
......
......@@ -350,6 +350,7 @@ void Req_Release(struct req *);
void Req_Rollback(struct req *req);
void Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req);
void Req_Fail(struct req *req, enum sess_close reason);
void Req_AcctLogCharge(struct VSC_main_wrk *, struct req *);
/* cache_req_body.c */
int VRB_Ignore(struct req *);
......
......@@ -338,7 +338,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
if (hs < HTC_S_EMPTY) {
req->acct.req_hdrbytes +=
req->htc->rxbuf_e - req->htc->rxbuf_b;
Req_Cleanup(sp, wrk, req);
Req_AcctLogCharge(wrk->stats, req);
Req_Release(req);
switch (hs) {
case HTC_S_CLOSE:
......@@ -359,7 +359,6 @@ HTTP1_Session(struct worker *wrk, struct req *req)
}
if (hs == HTC_S_IDLE) {
wrk->stats->sess_herd++;
Req_Cleanup(sp, wrk, req);
Req_Release(req);
SES_Wait(sp, &HTTP1_transport);
return;
......
......@@ -240,7 +240,7 @@ h2_ou_rel(struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
AZ(req->vcl);
Req_Cleanup(req->sp, wrk, req);
Req_AcctLogCharge(wrk->stats, req);
Req_Release(req);
return (0);
}
......
......@@ -37,6 +37,28 @@ client c2 {
expect_close
} -start
client c3 {
loop 3 {
# send a periodic CRLF
delay 0.3
sendhex 0d0a
}
delay 0.3
expect_close
} -start
client c4 {
txreq
rxresp
loop 3 {
# send a periodic CRLF
delay 0.3
sendhex 0d0a
}
delay 0.3
expect_close
} -start
client c1u -connect "${tmpdir}/v1.sock" {
txreq
rxresp
......@@ -57,7 +79,33 @@ client c2u -connect "${tmpdir}/v1.sock" {
expect_close
} -start
client c3u -connect "${tmpdir}/v1.sock" {
loop 3 {
# send a periodic CRLF
delay 0.3
sendhex 0d0a
}
delay 0.3
expect_close
} -start
client c4u -connect "${tmpdir}/v1.sock" {
txreq
rxresp
loop 3 {
# send a periodic CRLF
delay 0.3
sendhex 0d0a
}
delay 0.3
expect_close
} -start
client c1 -wait
client c2 -wait
client c3 -wait
client c4 -wait
client c1u -wait
client c2u -wait
client c3u -wait
client c4u -wait
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment