Commit 4b73c5f7 authored by Dag Haavi Finstad's avatar Dag Haavi Finstad

h2: Fix a possible thread leak scenario

If we have one or more streams set up because of a PRIORITY frame _and_
for some reason a tcp FIN is lost (or a client merely keeps a connection
open), this transaction would be stalled indefinitely.
parent a9454ef9
...@@ -964,6 +964,7 @@ static int ...@@ -964,6 +964,7 @@ static int
h2_sweep(struct worker *wrk, struct h2_sess *h2) h2_sweep(struct worker *wrk, struct h2_sess *h2)
{ {
int tmo = 0; int tmo = 0;
int nprio = 0;
struct h2_req *r2, *r22; struct h2_req *r2, *r22;
ASSERT_RXTHR(h2); ASSERT_RXTHR(h2);
...@@ -994,13 +995,21 @@ h2_sweep(struct worker *wrk, struct h2_sess *h2) ...@@ -994,13 +995,21 @@ h2_sweep(struct worker *wrk, struct h2_sess *h2)
continue; continue;
} }
break; break;
case H2_S_IDLE:
/* This stream was created from receiving a
* PRIORITY frame, and should not be counted
* as an active stream keeping the connection
* open. */
AZ(r2->scheduled);
nprio++;
break;
default: default:
break; break;
} }
} }
if (tmo) if (tmo)
return (0); return (0);
return (h2->refcnt > 1); return ((h2->refcnt - nprio) > 1);
} }
......
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