From: Willy Tarreau Date: Thu, 25 Oct 2018 08:28:27 +0000 (+0200) Subject: MEDIUM: stream: always call si_cs_recv() after a failed buffer allocation X-Git-Tag: v1.9-dev5~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18e066c2e7e6275d27383356c108cda0d17ad920;p=thirdparty%2Fhaproxy.git MEDIUM: stream: always call si_cs_recv() after a failed buffer allocation If a buffer allocation failed, we have SI_FL_WAIT_ROOM set and c_size(buf) being zero. It's the only moment where we have a new opportunity to try to allocate this buffer. However we don't want to waste our time trying this if both are non-null since it indicates missing room without any changed condition. --- diff --git a/src/stream.c b/src/stream.c index d27dae3a22..6f5372809e 100644 --- a/src/stream.c +++ b/src/stream.c @@ -1676,7 +1676,7 @@ struct task *process_stream(struct task *t, void *context, unsigned short state) co_data(si_oc(si_f))) si_cs_send(cs); if (!(si_f->wait_event.wait_reason & SUB_CAN_RECV) && - !(si_f->flags & SI_FL_WAIT_ROOM)) + (!(si_f->flags & SI_FL_WAIT_ROOM) || !c_size(req))) si_cs_recv(cs); } cs = objt_cs(si_b->end); @@ -1685,7 +1685,7 @@ struct task *process_stream(struct task *t, void *context, unsigned short state) co_data(si_oc(si_b))) si_cs_send(cs); if (!(si_b->wait_event.wait_reason & SUB_CAN_RECV) && - !(si_b->flags & SI_FL_WAIT_ROOM)) + (!(si_b->flags & SI_FL_WAIT_ROOM) || !c_size(res))) si_cs_recv(cs); } redo: