http_res_get_intercept_rule() stops http-response actions from yielding once
the client side is dead: when the frontend connector reports an error or an
early close, the action is called with ACT_OPT_FINAL, so a yield is refused
and the caller receives an HTTP_RULE_RES_ERROR instead of being left waiting
forever.
The server side was missing: when the backend connector reports an error
while an http-response action (e.g. send-spoe-group) is yielding, the action
kept waiting for a wakeup that would only ever come from the server it just
lost, and the response was stuck in the channel until the client timed out.
Add the missing server-side condition: an SC_FL_ERROR on the backend
connector also sets ACT_OPT_FINAL, so http-response actions get a final
chance to conclude when the server dies. Combined with the previous commit,
the "server answered early and reset its stream while the action was
pending" case from github issue #3559 now lets the action conclude with an
error instead of hanging the response.
This patch should be backported to all supported versions.
if (final)
act_opts |= ACT_OPT_FINAL;
- if ((s->scf->flags & SC_FL_ERROR) ||
+ if ((s->scf->flags & SC_FL_ERROR) || (s->scb->flags & SC_FL_ERROR) ||
((s->scf->flags & SC_FL_EOS) && proxy_abrt_close_def(px, 1)))
act_opts |= ACT_OPT_FINAL | ACT_OPT_FINAL_EARLY;