The previous patch accounts unconsumed data when QCS is freed before
being remotely closed. The objective is to ensure to limit the
inconsistency in conn flow control between client and server.
In fact, this patch is incomplete as peer consumed level cannot be known
before receiving its final size. Thus, discrepancies in connection flow
control may still appear over time. The proper method is to delay QCS
release until remote close is performed. However, this is a significant
change which will be implemented in a future patch.
This must be backported up to 2.8, after a period of observation
qcc_release_remote_stream(qcc, id);
}
+ /* If some data are not yet consumed, account them in conn flow
+ * control. On frontend, this may happen when FE stream is released
+ * prior to request completion.
+ *
+ * TODO QCS should not be released if not closed remotely to guarantee
+ * the connection flow control consistency
+ */
+ if (!qcs_is_close_remote(qcs) && qcs->rx.offset_max > qcs->rx.offset) {
+ COUNT_IF(1, "QCS is released while not remotely closed. "
+ "This may cause miscalculation in conn flow control.");
+ qcc_account_for_conn_fctl(qcc, qcs->rx.offset_max - qcs->rx.offset);
+ }
+
qcs_free(qcs);
/* Rearm http-keep-alive timeout when last request stream is freed. */