diff --git a/include/haproxy/stream.h b/include/haproxy/stream.h index 00f8175e19..a60e73f93e 100644 --- a/include/haproxy/stream.h +++ b/include/haproxy/stream.h @@ -342,6 +342,7 @@ static inline void stream_choose_redispatch(struct stream *s) if (may_dequeue_tasks(objt_server(s->target), s->be)) process_srv_queue(objt_server(s->target)); + sockaddr_free(&s->si[1].dst); s->flags &= ~(SF_DIRECT | SF_ASSIGNED | SF_ADDR_SET); si->state = SI_ST_REQ; } else { diff --git a/src/queue.c b/src/queue.c index 92692ab535..00e03a547c 100644 --- a/src/queue.c +++ b/src/queue.c @@ -600,6 +600,10 @@ int pendconn_dequeue(struct stream *strm) strm->flags &= ~(SF_DIRECT | SF_ASSIGNED | SF_ADDR_SET); strm->flags |= p->strm_flags & (SF_DIRECT | SF_ASSIGNED | SF_ADDR_SET); + /* the entry might have been redistributed to another server */ + if (!(strm->flags & SF_ADDR_SET)) + sockaddr_free(&strm->si[1].dst); + if (p->target) { /* a server picked this pendconn, it must skip LB */ strm->target = &p->target->obj_type;