Skip to content

Commit 512ce10

Browse files
committed
BUG/MINOR: sink: retry attempt for sft server may never occur
Since 9561b9f ("BUG/MINOR: sink: add tempo between 2 connection attempts for sft servers"), there is a possibility that the tempo we use to schedule the task expiry may point to TICK_ETERNITY as we add ticks to tempo with a simple addition that doesn't take care of potential wrapping. When this happens (although relatively rare, since now_ms only wraps every 49.7 days, but a forced wrap occurs 20 seconds after haproxy is started so it is more likely to happen there), the process_sink_forward() task expiry being set to TICK_ETERNITY, it may never be called again, this is especially true if the ring section only contains a single server. To fix the issue, we must use tick_add() helper function to set the tempo value and this way we ensure that the value will never be TICK_ETERNITY. It must be backported everywhere 9561b9f was backported (up to 2.6 it seems). (cherry picked from commit c26ac3f5e44b78b7fc4caaaa6f8a8ea807178438) Signed-off-by: Aurelien DARRAGON <adarragon@haproxy.com> (cherry picked from commit 27e59792c158aef7219194f43bc9e2d9d060b758) Signed-off-by: Aurelien DARRAGON <adarragon@haproxy.com> (cherry picked from commit 0a1603052030876249140f2a92038f79611faa58) Signed-off-by: Aurelien DARRAGON <adarragon@haproxy.com> (cherry picked from commit b2cd824a3d48fa279cd49d0ffd609a9f7a8f6e05) Signed-off-by: Aurelien DARRAGON <adarragon@haproxy.com>
1 parent f3b71c0 commit 512ce10

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/sink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ static struct task *process_sink_forward(struct task * task, void *context, unsi
704704
* establishment attempt per second.
705705
*/
706706
if (!sft->appctx) {
707-
uint tempo = sft->last_conn + MS_TO_TICKS(1000);
707+
int tempo = tick_add(sft->last_conn, MS_TO_TICKS(1000));
708708

709709
if (sft->last_conn == TICK_ETERNITY || tick_is_expired(tempo, now_ms))
710710
sft->appctx = sink_forward_session_create(sink, sft);

0 commit comments

Comments
 (0)