stable-bot: Bugfixes waiting for a release 2.1 (1), 2.0 (48)

2020-06-02 Thread stable-bot
Hi,

This is a friendly bot that watches fixes pending for the next haproxy-stable 
release!  One such e-mail is sent periodically once patches are waiting in the 
last maintenance branch, and an ideal release date is computed based on the 
severity of these fixes and their merge date.  Responses to this mail must be 
sent to the mailing list.


Last release 2.1.5 was issued on 2020-05-29.  There are currently 1 patches in 
the queue cut down this way:
- 1 MEDIUM, first one merged on 2020-06-02

Thus the computed ideal release date for 2.1.6 would be 2020-07-02, which is in 
four weeks or less.

Last release 2.0.14 was issued on 2020-04-02.  There are currently 48 patches 
in the queue cut down this way:
- 1 MAJOR, first one merged on 2020-05-22
- 19 MEDIUM, first one merged on 2020-05-07
- 28 MINOR, first one merged on 2020-04-02

Thus the computed ideal release date for 2.0.15 would be 2020-04-30, which was 
five weeks ago.

The current list of patches in the queue is:
 - 2.0   - MAJOR   : stream-int: always detach a faulty 
endpoint on connect failure
 - 2.0   - MEDIUM  : stream: Only allow L7 retries when 
using HTTP.
 - 2.0, 2.1  - MEDIUM  : connections: force connections cleanup 
on server changes
 - 2.0   - MEDIUM  : http-ana: Handle NTLM messages 
correctly.
 - 2.0   - MEDIUM  : http: the "http_first_req" sample 
fetch could crash without a steeam
 - 2.0   - MEDIUM  : http_ana: make the detection of NTLM 
variants safer
 - 2.0   - MEDIUM  : shctx: really check the lock's value 
while waiting
 - 2.0   - MEDIUM  : checks: Always initialize checks 
before starting them
 - 2.0   - MEDIUM  : ssl: fix the id length check within 
smp_fetch_ssl_fc_session_id()
 - 2.0   - MEDIUM  : listener: mark the thread as not stuck 
inside the loop
 - 2.0   - MEDIUM  : sample: make the CPU and latency 
sample fetches check for a stream
 - 2.0   - MEDIUM  : http: the "unique-id" sample fetch 
could crash without a steeam
 - 2.0   - MEDIUM  : backend: don't access a non-existing 
mux from a previous connection
 - 2.0   - MEDIUM  : lua: Fix dumping of stick table 
entries for STD_T_DICT
 - 2.0   - MEDIUM  : capture: capture-req/capture-res 
converters crash without a stream
 - 2.0   - MEDIUM  : shctx: bound the number of loops that 
can happen around the lock
 - 2.0   - MEDIUM  : streams: Remove SF_ADDR_SET if we're 
retrying due to L7 retry.
 - 2.0   - MEDIUM  : capture: capture.{req,res}.* crash 
without a stream
 - 2.0   - MEDIUM  : server/checks: Init server check 
during config validity check
 - 2.0, 2.1  - MEDIUM  : connections: force connections cleanup 
on server changes"
 - 2.0   - MINOR   : soft-stop: always wake up waiting 
threads on stopping
 - 2.0   - MINOR   : obj_type: Handle stream object in 
obj_base_ptr() function
 - 2.0   - MINOR   : pools: use %u not %d to report pool 
stats in "show pools"
 - 2.0   - MINOR   : checks: Remove a warning about http 
health checks
 - 2.0   - MINOR   : check: Update server address and port 
to execute an external check
 - 2.0   - MINOR   : peers: Incomplete peers sections 
should be validated.
 - 2.0   - MINOR   : nameservers: fix error handling in 
parsing of resolv.conf
 - 2.0   - MINOR   : protocol_buffer: Wrong maximum 
shifting.
 - 2.0   - MINOR   : checks: chained expect will not 
properly wait for enough data
 - 2.0   - MINOR   : config: Make use_backend and 
use-server post-parsing less obscur
 - 2.0   - MINOR   : cache: Don't needlessly test "cache" 
keyword in parse_cache_flt()
 - 2.0   - MINOR   : threads: fix multiple use of argument 
inside HA_ATOMIC_CAS()
 - 2.0   - MINOR   : cfgparse: Abort parsing the current 
line if an invalid \x sequence is encountered
 - 2.0   - MINOR   : server: Fix server_finalize_init() to 
avoid unused variable
 - 2.0   - MINOR   : debug: properly use long long instead 
of long for the thread ID
 - 2.0   - MINOR   : ssl: default settings for ssl server 
options are not used
 - 2.0   - MINOR   : tools: fix the i386 version of the 
div64_32 function
 - 2.0   - MINOR   : http: make url_decode() optionally 
convert '+' to SP
 - 2.0   - MINOR   : checks: Respect check-ssl param when a 
port or an addr is specified
 - 2.0   - MINOR   : connectio

Re: [v2.0 PATCH] Revert "BUG/MEDIUM: connections: force connections cleanup on server changes"

2020-06-02 Thread Christopher Faulet

Le 02/06/2020 à 16:05, William Dauchy a écrit :

As explained by Christopher on github issue #665:
In 2.2, srv->idle_conns and srv->safe_conns are thread-safe lists. But
not in 2.1. So the patch must be reverted or the lists must be changed
to use mt_list instead. The same must be done in 2.0, but the mt_list
does not exist on this version.

I choose to revert it as the original bug is truly revealed in v2.2
after commit 079cb9af22da6 ("MEDIUM: connections: Revamp the way idle
connections are killed")

this should resolve github issue #665

This reverts commit e18f603012fe3b698a30fcedfb0684f48fe403aa.
This reverts commit 3b614335cf25a7081c25e0a789c932c5960f221c.
---


Thanks William,

I backported the patch from the 2.1, mentioning commit ids of the 2.0. But 
applied so :)


--
Christopher Faulet



Re: [ANNOUNCE] haproxy-2.1.5

2020-06-02 Thread William Dauchy
On Tue, Jun 2, 2020 at 12:13 PM William Dauchy  wrote:
> it seems like I broke something with this commit, but I did not have
> it in v2.2

small followup:
Sorry for that one, the backport was not exactly as I thought, and so
no test were done before release outside of 2.2 branch:
- a small mistake in index within a loop
- more importantly, srv->idle_conns and srv->safe_conns are not
thread-safe list in 2.0 and 2.1

I choose to revert the changes < 2.2
-- 
William



Re: [v2.1 PATCH] Revert "BUG/MEDIUM: connections: force connections cleanup on server changes"

2020-06-02 Thread Christopher Faulet

Le 02/06/2020 à 16:03, William Dauchy a écrit :

As explained by Christopher on github issue #665:
In 2.2, srv->idle_conns and srv->safe_conns are thread-safe lists. But
not in 2.1. So the patch must be reverted or the lists must be changed
to use mt_list instead. The same must be done in 2.0, but the mt_list
does not exist on this version.

I choose to revert it as the original bug is truly revealed in v2.2
after commit 079cb9af22da6 ("MEDIUM: connections: Revamp the way idle
connections are killed")

this should resolve github issue #665

this reverts commit 7eab37b6819af685c647cf5a581e29fca2f3e079.
this reverts commit 3ad3306ec0bcb0cd4ca2b9ba134ed67663473ee8.


Thanks William, now applied !

--
Christopher Faulet



Re: Peers Protocol "Table Type"

2020-06-02 Thread Willy TARREAU
On Tue, Jun 02, 2020 at 04:25:11PM +0200, Tim Düsterhus wrote:
> This looks good to me now. I trust that you actually tested the changes.
> 
> Reviewed-by: Tim Duesterhus 

Argh one minute too late, just applied :-/

Thanks anyway for your review Tim!
Willy



Re: Peers Protocol "Table Type"

2020-06-02 Thread Willy TARREAU
On Tue, Jun 02, 2020 at 03:10:08PM +0200, Emeric Brun wrote:
> Thank you Tim!
> 
> Here the updated patch.

Thanks guys, now applied.

Willy



Re: Peers Protocol "Table Type"

2020-06-02 Thread Tim Düsterhus
Emeric,
Willy,

Am 02.06.20 um 15:10 schrieb Emeric Brun:
> Thank you Tim!
> 
> Here the updated patch.

This looks good to me now. I trust that you actually tested the changes.

Reviewed-by: Tim Duesterhus 

Best regards
Tim Düsterhus



crashes with 2.0.14

2020-06-02 Thread Sander Hoentjen

Hi list,

Some time ago (around april 21st) we were using 1.8.13 and we switched 
from nbthread = 1 to nbthread = 4


This seemed stable for us, but 2 weeks ago we started seeing hangs (100% 
CPU haproxy processes)


We then updated to haproxy 2.0.14. The hangs are gone, but instead we 
see disappearing haproxy processes.


I turned on coredumps, and I have some output from gdb.

Hope this is helpful in figuring out what's wrong.

=

(gdb) bt
#0  0x7fb4770854f5 in raise () from /lib64/libc.so.6
#1  0x7fb477086cd5 in abort () from /lib64/libc.so.6
#2  0x0054ce3c in ha_panic () at src/debug.c:207
#3  0x0054d674 in wdt_handler (sig=14, si=, 
arg=) at src/wdt.c:119

#4  
#5  0x7fb47713ccd7 in socket () from /lib64/libc.so.6
#6  0x004fc75e in my_socketat (conn=0x7fb470036490, flags=8) at 
include/common/namespace.h:28
#7  create_server_socket (conn=0x7fb470036490, flags=8) at 
src/proto_tcp.c:257

#8  tcp_connect_server (conn=0x7fb470036490, flags=8) at src/proto_tcp.c:323
#9  0x004e8c94 in si_connect (s=0x7fb4703ad540) at 
include/proto/stream_interface.h:513

#10 connect_server (s=0x7fb4703ad540) at src/backend.c:1591
#11 0x0044f373 in sess_update_stream_int (s=0x7fb4703ad540) at 
src/stream.c:1015
#12 0x0045527e in process_stream (t=0x7fb4703b5620, 
context=0x7fb4703ad540, state=)

    at src/stream.c:2414
#13 0x0052a875 in process_runnable_tasks () at src/task.c:413
#14 0x004980f8 in run_poll_loop (data=) at 
src/haproxy.c:2627

#15 run_thread_poll_loop (data=) at src/haproxy.c:2754
#16 0x7fb477a25aa1 in start_thread (arg=0x7fb476786700) at 
pthread_create.c:301

#17 0x7fb47713bc2d in clone () from /lib64/libc.so.6
(gdb) bt full
#0  0x7fb4770854f5 in raise () from /lib64/libc.so.6
No symbol table info available.
#1  0x7fb477086cd5 in abort () from /lib64/libc.so.6
No symbol table info available.
#2  0x0054ce3c in ha_panic () at src/debug.c:207
No locals.
#3  0x0054d674 in wdt_handler (sig=14, si=, 
arg=) at src/wdt.c:119

    n = 
    p = 
    thr = 1
#4  
No symbol table info available.
#5  0x7fb47713ccd7 in socket () from /lib64/libc.so.6
No symbol table info available.
#6  0x004fc75e in my_socketat (conn=0x7fb470036490, flags=8) at 
include/common/namespace.h:28

No locals.
#7  create_server_socket (conn=0x7fb470036490, flags=8) at 
src/proto_tcp.c:257

    ns = 0x0
#8  tcp_connect_server (conn=0x7fb470036490, flags=8) at src/proto_tcp.c:323
    fd = 
    srv = 0x4850bf0
    be = 0x25606b0
    src = 
    use_fastopen = 0
    addr = 
#9  0x004e8c94 in si_connect (s=0x7fb4703ad540) at 
include/proto/stream_interface.h:513

    ret = 0
    conn_flags = 
---Type  to continue, or q  to quit---
#10 connect_server (s=0x7fb4703ad540) at src/backend.c:1591
    cli_conn = 0x7fb4703ca8f0
    srv_conn = 0x7fb470036490
    old_conn = 
    srv_cs = 0x7fb4703eb310
    srv = 
    reuse = 
    reuse_orphan = 
    init_mux = 1
    alloced_cs = 
    err = 
#11 0x0044f373 in sess_update_stream_int (s=0x7fb4703ad540) at 
src/stream.c:1015

    conn_err = 
    srv = 0x4850bf0
    si = 0x7fb4703ad840
    req = 0x7fb4703ad550
#12 0x0045527e in process_stream (t=0x7fb4703b5620, 
context=0x7fb4703ad540, state=)

    at src/stream.c:2414
    srv = 
    s = 0x7fb4703ad540
    sess = 0x7fb4703ca620
    rqf_last = 9469952
    rpf_last = 2147483648
    rq_prod_last = 8
    rq_cons_last = 0
    rp_cons_last = 8
    rp_prod_last = 0
    req_ana_back = 0
---Type  to continue, or q  to quit---
    req = 0x7fb4703ad550
    res = 0x7fb4703ad5b0
    si_f = 0x7fb4703ad7e8
    si_b = 0x7fb4703ad840
    rate = 151
#13 0x0052a875 in process_runnable_tasks () at src/task.c:413
    t = 0x7fb4703b5620
    state = 
    ctx = 
    process = 0x453b30 
    lrq = 
    grq = 
    t = 
    max_processed = 46
#14 0x004980f8 in run_poll_loop (data=) at 
src/haproxy.c:2627

    next = 
    wake = 
#15 run_thread_poll_loop (data=) at src/haproxy.c:2754
    ptaf = 
    ptif = 
    ptdf = 
    ptff = 
    init_left = 0
    init_mutex = {__data = {__lock = 0, __count = 0, __owner = 0, 
__nusers = 0, __kind = 0, __spins = 0,
    __list = {__prev = 0x0, __next = 0x0}}, __size = '\000' 
, __align = 0}
    init_cond = {__data = {__lock = 0, __futex = 10, __total_seq = 
5, __wakeup_seq = 5, __woken_seq = 5,

    __mutex = 0xa42120, __nwaiters = 0, __broadcast_seq = 3},
  __size = 
"\000\000\000\000\n\000\000\000\005\000\000\000\000\000\000\000\005\000\000\000\000\000\000\000\005\---Type 
 to continue, or q  to quit---
000\000\000\000\000\000\000 
!\244\000\000\000\000\000\000\000\000\000\003

[v2.0 PATCH] Revert "BUG/MEDIUM: connections: force connections cleanup on server changes"

2020-06-02 Thread William Dauchy
As explained by Christopher on github issue #665:
In 2.2, srv->idle_conns and srv->safe_conns are thread-safe lists. But
not in 2.1. So the patch must be reverted or the lists must be changed
to use mt_list instead. The same must be done in 2.0, but the mt_list
does not exist on this version.

I choose to revert it as the original bug is truly revealed in v2.2
after commit 079cb9af22da6 ("MEDIUM: connections: Revamp the way idle
connections are killed")

this should resolve github issue #665

This reverts commit e18f603012fe3b698a30fcedfb0684f48fe403aa.
This reverts commit 3b614335cf25a7081c25e0a789c932c5960f221c.
---
 src/server.c | 39 +--
 1 file changed, 1 insertion(+), 38 deletions(-)

diff --git a/src/server.c b/src/server.c
index 851f32a9..9f2452e0 100644
--- a/src/server.c
+++ b/src/server.c
@@ -51,7 +51,6 @@ static void srv_update_status(struct server *s);
 static void srv_update_state(struct server *srv, int version, char **params);
 static int srv_apply_lastaddr(struct server *srv, int *err_code);
 static int srv_set_fqdn(struct server *srv, const char *fqdn, int dns_locked);
-static void srv_cleanup_connections(struct server *srv);
 
 /* List head of all known server keywords */
 static struct srv_kw_list srv_keywords = {
@@ -3780,11 +3779,8 @@ const char *update_server_addr_port(struct server *s, 
const char *addr, const ch
}
 
 out:
-   if (changed) {
-   /* force connection cleanup on the given server */
-   srv_cleanup_connections(s);
+   if (changed)
srv_set_dyncookie(s);
-   }
if (updater)
chunk_appendf(msg, " by '%s'", updater);
chunk_appendf(msg, "\n");
@@ -5016,8 +5012,6 @@ static void srv_update_status(struct server *s)
if (s->onmarkeddown & 
HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS)
srv_shutdown_streams(s, SF_ERR_DOWN);
 
-   /* force connection cleanup on the given server */
-   srv_cleanup_connections(s);
/* we might have streams queued on this server and 
waiting for
 * a connection. Those which are redispatchable will be 
queued
 * to another server or to the proxy itself.
@@ -5346,37 +5340,6 @@ struct task *srv_cleanup_toremove_connections(struct 
task *task, void *context,
return task;
 }
 
-/* cleanup connections for a given server
- * might be useful when going on forced maintenance or live changing ip/port
- */
-static void srv_cleanup_connections(struct server *srv)
-{
-   struct connection *conn;
-   int did_remove;
-   int i;
-   int j;
-
-   HA_SPIN_LOCK(OTHER_LOCK, &idle_conn_srv_lock);
-   for (i = 0; i < global.nbthread; i++) {
-   did_remove = 0;
-   HA_SPIN_LOCK(OTHER_LOCK, &toremove_lock[i]);
-   for (j = 0; j < srv->curr_idle_conns; j++) {
-   conn = LIST_ELEM(srv->idle_conns[tid].n, struct 
connection *, list);
-   if (!conn)
-   conn = LIST_ELEM(srv->safe_conns[tid].n,
-struct connection *, list);
-   if (!conn)
-   break;
-   did_remove = 1;
-   LIST_ADDQ_LOCKED(&toremove_connections[i], &conn->list);
-   }
-   HA_SPIN_UNLOCK(OTHER_LOCK, &toremove_lock[i]);
-   if (did_remove)
-   task_wakeup(idle_conn_cleanup[i], TASK_WOKEN_OTHER);
-   }
-   HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conn_srv_lock);
-}
-
 struct task *srv_cleanup_idle_connections(struct task *task, void *context, 
unsigned short state)
 {
struct server *srv;
-- 
2.26.2




[v2.1 PATCH] Revert "BUG/MEDIUM: connections: force connections cleanup on server changes"

2020-06-02 Thread William Dauchy
As explained by Christopher on github issue #665:
In 2.2, srv->idle_conns and srv->safe_conns are thread-safe lists. But
not in 2.1. So the patch must be reverted or the lists must be changed
to use mt_list instead. The same must be done in 2.0, but the mt_list
does not exist on this version.

I choose to revert it as the original bug is truly revealed in v2.2
after commit 079cb9af22da6 ("MEDIUM: connections: Revamp the way idle
connections are killed")

this should resolve github issue #665

this reverts commit 7eab37b6819af685c647cf5a581e29fca2f3e079.
this reverts commit 3ad3306ec0bcb0cd4ca2b9ba134ed67663473ee8.
---
 src/server.c | 39 +--
 1 file changed, 1 insertion(+), 38 deletions(-)

diff --git a/src/server.c b/src/server.c
index 7d44921a7..408458f0c 100644
--- a/src/server.c
+++ b/src/server.c
@@ -55,7 +55,6 @@ static int srv_apply_lastaddr(struct server *srv, int 
*err_code);
 static int srv_set_fqdn(struct server *srv, const char *fqdn, int dns_locked);
 static void srv_state_parse_line(char *buf, const int version, char **params, 
char **srv_params);
 static int srv_state_get_version(FILE *f);
-static void srv_cleanup_connections(struct server *srv);
 
 /* List head of all known server keywords */
 static struct srv_kw_list srv_keywords = {
@@ -3945,11 +3944,8 @@ const char *update_server_addr_port(struct server *s, 
const char *addr, const ch
}
 
 out:
-   if (changed) {
-   /* force connection cleanup on the given server */
-   srv_cleanup_connections(s);
+   if (changed)
srv_set_dyncookie(s);
-   }
if (updater)
chunk_appendf(msg, " by '%s'", updater);
chunk_appendf(msg, "\n");
@@ -5110,8 +5106,6 @@ static void srv_update_status(struct server *s)
if (s->onmarkeddown & 
HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS)
srv_shutdown_streams(s, SF_ERR_DOWN);
 
-   /* force connection cleanup on the given server */
-   srv_cleanup_connections(s);
/* we might have streams queued on this server and 
waiting for
 * a connection. Those which are redispatchable will be 
queued
 * to another server or to the proxy itself.
@@ -5440,37 +5434,6 @@ struct task *srv_cleanup_toremove_connections(struct 
task *task, void *context,
return task;
 }
 
-/* cleanup connections for a given server
- * might be useful when going on forced maintenance or live changing ip/port
- */
-static void srv_cleanup_connections(struct server *srv)
-{
-   struct connection *conn;
-   int did_remove;
-   int i;
-   int j;
-
-   HA_SPIN_LOCK(OTHER_LOCK, &idle_conn_srv_lock);
-   for (i = 0; i < global.nbthread; i++) {
-   did_remove = 0;
-   HA_SPIN_LOCK(OTHER_LOCK, &toremove_lock[i]);
-   for (j = 0; j < srv->curr_idle_conns; j++) {
-   conn = LIST_ELEM(srv->idle_conns[tid].n, struct 
connection *, list);
-   if (!conn)
-   conn = LIST_ELEM(srv->safe_conns[tid].n,
-struct connection *, list);
-   if (!conn)
-   break;
-   did_remove = 1;
-   MT_LIST_ADDQ(&toremove_connections[i], (struct mt_list 
*)&conn->list);
-   }
-   HA_SPIN_UNLOCK(OTHER_LOCK, &toremove_lock[i]);
-   if (did_remove)
-   task_wakeup(idle_conn_cleanup[i], TASK_WOKEN_OTHER);
-   }
-   HA_SPIN_UNLOCK(OTHER_LOCK, &idle_conn_srv_lock);
-}
-
 struct task *srv_cleanup_idle_connections(struct task *task, void *context, 
unsigned short state)
 {
struct server *srv;
-- 
2.26.2




Re: Peers Protocol "Table Type"

2020-06-02 Thread Emeric Brun
Hi All,

On 6/2/20 1:10 PM, Tim Düsterhus wrote:
> Emeric,
> 
> Am 02.06.20 um 11:29 schrieb Emeric Brun:
>> In attachement a proposed patch for this issue.
>>
> 
> Thanks. The changes to the doc look good to me.
> 
> Regarding peers.c:
> 
>> +/* network key types;
>> + * network types were directly and mistakenly
>> + * mapped on sample types, to keep backward
>> + * compatiblitiy we keep those values but
>> + * we now use a internal/network mapping
>> + * to avoid further mistakes adding or
>> + * modifying internals types
>> + */
>> +enum {
>> +PEER_KT_ANY = 0,  /* any type */
>> +PEER_KT_RESV1,/* UNUSED */
>> +PEER_KT_SINT, /* signed 64bits integer type */
>> +PEER_KT_RESV2,/* UNUSED */
> 
> Maybe call this RESV3 to make it clear that the numeric value is '3'.
> 
>> +PEER_KT_IPV4, /* ipv4 type */
>> +PEER_KT_IPV6, /* ipv6 type */
>> +PEER_KT_STR,  /* char string type */
>> +PEER_KT_BIN,  /* buffer type */
>> +PEER_KT_TYPES /* number of types, must always be last */
>> +};
> 
> -
> 
>> + * Note: Undeclared mapping maps entry to SMP_ST_ANY == 0
> 
> This should read SMP_T_ANY.
> 
> Also backporting instructions are missing from the commit message.
> 
> Other than that the patch looks good to me, but I didn't actually test a
> binary compiled from it.
> 
> Best regards
> Tim Düsterhus
> 

Thank you Tim!

Here the updated patch.

R,
Emeric
>From c58eed60557fd20e8b972cc3ab4b45e4e598e558 Mon Sep 17 00:00:00 2001
From: Emeric Brun 
Date: Tue, 2 Jun 2020 11:17:42 +0200
Subject: [PATCH] BUG/MINOR: peers: fix internal/network key type mapping.

Network types were directly and mistakenly mapped on sample types:

This patch fix the doc with values effectively used to keep backward
compatiblitiy on existing implementations.

In addition it adds an internal/network mapping for key types to avoid
further mistakes adding or modifying internals types.

This patch should be backported on all maintained branches,
particularly until v1.8 included for documentation part.
---
 doc/peers-v2.0.txt | 10 +-
 src/peers.c| 46 --
 2 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/doc/peers-v2.0.txt b/doc/peers-v2.0.txt
index 477e7bb84..344cb5609 100644
--- a/doc/peers-v2.0.txt
+++ b/doc/peers-v2.0.txt
@@ -191,11 +191,11 @@ between the "Sender Table ID" to identify it directly in case of "Table Switch M
 
 Table Type present the numeric type of key used to store stick table entries:
 integer
- 0: signed integer
- 1: IPv4 address
- 2: IPv6 address
- 3: string
- 4: binary
+ 2: signed integer
+ 4: IPv4 address
+ 5: IPv6 address
+ 6: string
+ 7: binary
 
 Table Keylen present the key length or max length in case of strings or binary (padded with 0).
 
diff --git a/src/peers.c b/src/peers.c
index 2e54ab94d..9782ff3c1 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -125,6 +125,48 @@ enum {
 	PEER_MSG_ERR_SIZELIMIT,
 };
 
+/* network key types;
+ * network types were directly and mistakenly
+ * mapped on sample types, to keep backward
+ * compatiblitiy we keep those values but
+ * we now use a internal/network mapping
+ * to avoid further mistakes adding or
+ * modifying internals types
+ */
+enum {
+PEER_KT_ANY = 0,  /* any type */
+PEER_KT_RESV1,/* UNUSED */
+PEER_KT_SINT, /* signed 64bits integer type */
+PEER_KT_RESV3,/* UNUSED */
+PEER_KT_IPV4, /* ipv4 type */
+PEER_KT_IPV6, /* ipv6 type */
+PEER_KT_STR,  /* char string type */
+PEER_KT_BIN,  /* buffer type */
+PEER_KT_TYPES /* number of types, must always be last */
+};
+
+/* Map used to retrieve network type from internal type
+ * Note: Undeclared mapping maps entry to PEER_KT_ANY == 0
+ */
+static int peer_net_key_type[SMP_TYPES] = {
+	[SMP_T_SINT] = PEER_KT_SINT,
+	[SMP_T_IPV4] = PEER_KT_IPV4,
+	[SMP_T_IPV6] = PEER_KT_IPV6,
+	[SMP_T_STR]  = PEER_KT_STR,
+	[SMP_T_BIN]  = PEER_KT_BIN,
+};
+
+/* Map used to retrieve internal type from external type
+ * Note: Undeclared mapping maps entry to SMP_T_ANY == 0
+ */
+static int peer_int_key_type[PEER_KT_TYPES] = {
+	[PEER_KT_SINT] = SMP_T_SINT,
+	[PEER_KT_IPV4] = SMP_T_IPV4,
+	[PEER_KT_IPV6] = SMP_T_IPV6,
+	[PEER_KT_STR]  = SMP_T_STR,
+	[PEER_KT_BIN]  = SMP_T_BIN,
+};
+
 /*
  * Parameters used by functions to build peer protocol messages. */
 struct peer_prep_params {
@@ -620,7 +662,7 @@ static int peer_prepare_switchmsg(char *msg, size_t size, struct peer_prep_param
 
 	/* encode table type */
 
-	intencode(st->table->type, &cursor);
+	intencode(peer_net_key_type[st->table->type], &cursor);
 
 	/* encode table key size */
 	intencode(st->table->key_size, &cursor);
@@ -1655,7 +1697,7 @@ static inline int peer_treat_definemsg(struct appctx *appctx, struct peer *p,
 	if (!*msg_cur)
 		goto malformed_exit;
 
-	if (p->remote_table->table->type != table_type
+	if (p->r

Re: Termination state: CL--

2020-06-02 Thread Baptiste
On Mon, Jun 1, 2020 at 1:40 PM Gaetan Deputier <
gaetan.deput...@googlemail.com> wrote:

> Hello!
>
> We have recently observed that a very small amount of our connections were
> ended with the following state: CL--. Those connections are coming from
> browsers and are correlated to weird behaviours observed in our downstream
> application (where a HTTP header and a body seem to be exchanged with
> another request).
>
> Looking at the documentation, this state that:
>
>
> *C : the TCP session was unexpectedly aborted by the client.L : the proxy
> was still transmitting LAST data to the client while the server had already
> finished. This one is very rare as it can only happen when the client dies
> while receiving the last packets.*
>
> Does someone have more details about the L state specifically? What we
> should we expect in our application in terms of sessions/packets/request?
> Thanks!
> G-
>


Hi Gaetan,

As Alexandar  said, we would need your anonymized configuration and your
haproxy version.

Baptiste


Re: Peers Protocol "Table Type"

2020-06-02 Thread Tim Düsterhus
Emeric,

Am 02.06.20 um 11:29 schrieb Emeric Brun:
> In attachement a proposed patch for this issue.
> 

Thanks. The changes to the doc look good to me.

Regarding peers.c:

> +/* network key types;
> + * network types were directly and mistakenly
> + * mapped on sample types, to keep backward
> + * compatiblitiy we keep those values but
> + * we now use a internal/network mapping
> + * to avoid further mistakes adding or
> + * modifying internals types
> + */
> +enum {
> +PEER_KT_ANY = 0,  /* any type */
> +PEER_KT_RESV1,/* UNUSED */
> +PEER_KT_SINT, /* signed 64bits integer type */
> +PEER_KT_RESV2,/* UNUSED */

Maybe call this RESV3 to make it clear that the numeric value is '3'.

> +PEER_KT_IPV4, /* ipv4 type */
> +PEER_KT_IPV6, /* ipv6 type */
> +PEER_KT_STR,  /* char string type */
> +PEER_KT_BIN,  /* buffer type */
> +PEER_KT_TYPES /* number of types, must always be last */
> +};

-

> + * Note: Undeclared mapping maps entry to SMP_ST_ANY == 0

This should read SMP_T_ANY.

Also backporting instructions are missing from the commit message.

Other than that the patch looks good to me, but I didn't actually test a
binary compiled from it.

Best regards
Tim Düsterhus



Re: [ANNOUNCE] haproxy-2.1.5

2020-06-02 Thread William Dauchy
On Fri, May 29, 2020 at 4:31 PM William Lallemand
 wrote:
> William Dauchy fixed the connection idle cleanup upon a server maintenance or
> an ip/port change.
>   BUG/MEDIUM: connections: force connections cleanup on server changes

it seems like I broke something with this commit, but I did not have
it in v2.2 unless it is also the cause of issue #662

#0  0x7fac7d4f0500 in ?? ()
#1  0x55afb63fd2d9 in srv_cleanup_toremove_connections
(task=0x7fac7c81b980, context=, state=)
at src/server.c:5437
#2  0x55afb6485248 in process_runnable_tasks () at src/task.c:433
#3  0x55afb6435594 in run_poll_loop () at src/haproxy.c:2743
#4  0x55afb643599d in run_thread_poll_loop (data=)
at src/haproxy.c:2878
#5  0x7faca30bfea5 in start_thread () from /lib64/libpthread.so.0
#6  0x7faca1b6f8dd in clone () from /lib64/libc.so.6

I will have a look at it today.
-- 
William



Re: Peers Protocol "Table Type"

2020-06-02 Thread Emeric Brun
Hi Tim, Willy,
On 3/20/20 3:01 PM, Tim Düsterhus wrote:
> Emeric,
> 
> Am 20.03.20 um 14:29 schrieb Emeric Brun:
>> So I understand that since 1.6 the SMP_T are directly announced on the wire 
>> for key types, and it brokes the documented values and this is hazardous to 
>> rely on internal enum values.
>>
>> So we must re-introduce a mapping between internal and on-wire types.
>>
>> Some questions about choices:
>>
>> - Re-map types to documented values or Update the doc to match currently 
>> used values? 
> 
> There's really only one sane choice after several years of not following
> the documentation:
> 
> Update the documentation to match the currently used values. The peers
> protocol is HAProxy specific, so in practice the correct values are
> "what HAProxy does" (i.e. the protocol is defined by the reference
> implementation). The custom implementation during which I stumbled upon
> this issue is brand new and I needed to look into the code anyway,
> because the docs are incomplete (as I outlined before in this thread).
> 
> Changing the code will cause larger breakage during a HAProxy bugfix
> upgrade if not all machines in a cluster are upgraded simultaneously.
> 
> Best regards
> Tim Düsterhus
> 

In attachement a proposed patch for this issue.

R,
Emeric
>From 3792e5fb69a10daf03f65d142fa308c8f2704588 Mon Sep 17 00:00:00 2001
From: Emeric Brun 
Date: Tue, 2 Jun 2020 11:17:42 +0200
Subject: [PATCH] BUG/MINOR: peers: fix internal/network key type mapping.

Network types were directly and mistakenly mapped on sample types:

This patch fix the doc with values effectively used to keep backward
compatiblitiy on existing implementations.

In addition it adds an internal/network mapping for key types to avoid
further mistakes adding or modifying internals types.
---
 doc/peers-v2.0.txt | 10 +-
 src/peers.c| 46 --
 2 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/doc/peers-v2.0.txt b/doc/peers-v2.0.txt
index 477e7bb84..344cb5609 100644
--- a/doc/peers-v2.0.txt
+++ b/doc/peers-v2.0.txt
@@ -191,11 +191,11 @@ between the "Sender Table ID" to identify it directly in case of "Table Switch M
 
 Table Type present the numeric type of key used to store stick table entries:
 integer
- 0: signed integer
- 1: IPv4 address
- 2: IPv6 address
- 3: string
- 4: binary
+ 2: signed integer
+ 4: IPv4 address
+ 5: IPv6 address
+ 6: string
+ 7: binary
 
 Table Keylen present the key length or max length in case of strings or binary (padded with 0).
 
diff --git a/src/peers.c b/src/peers.c
index 2e54ab94d..91f2b3ad8 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -125,6 +125,48 @@ enum {
 	PEER_MSG_ERR_SIZELIMIT,
 };
 
+/* network key types;
+ * network types were directly and mistakenly
+ * mapped on sample types, to keep backward
+ * compatiblitiy we keep those values but
+ * we now use a internal/network mapping
+ * to avoid further mistakes adding or
+ * modifying internals types
+ */
+enum {
+PEER_KT_ANY = 0,  /* any type */
+PEER_KT_RESV1,/* UNUSED */
+PEER_KT_SINT, /* signed 64bits integer type */
+PEER_KT_RESV2,/* UNUSED */
+PEER_KT_IPV4, /* ipv4 type */
+PEER_KT_IPV6, /* ipv6 type */
+PEER_KT_STR,  /* char string type */
+PEER_KT_BIN,  /* buffer type */
+PEER_KT_TYPES /* number of types, must always be last */
+};
+
+/* Map used to retrieve network type from internal type
+ * Note: Undeclared mapping maps entry to PEER_KT_ANY == 0
+ */
+static int peer_net_key_type[SMP_TYPES] = {
+	[SMP_T_SINT] = PEER_KT_SINT,
+	[SMP_T_IPV4] = PEER_KT_IPV4,
+	[SMP_T_IPV6] = PEER_KT_IPV6,
+	[SMP_T_STR]  = PEER_KT_STR,
+	[SMP_T_BIN]  = PEER_KT_BIN,
+};
+
+/* Map used to retrieve internal type from external type
+ * Note: Undeclared mapping maps entry to SMP_ST_ANY == 0
+ */
+static int peer_int_key_type[PEER_KT_TYPES] = {
+	[PEER_KT_SINT] = SMP_T_SINT,
+	[PEER_KT_IPV4] = SMP_T_IPV4,
+	[PEER_KT_IPV6] = SMP_T_IPV6,
+	[PEER_KT_STR]  = SMP_T_STR,
+	[PEER_KT_BIN]  = SMP_T_BIN,
+};
+
 /*
  * Parameters used by functions to build peer protocol messages. */
 struct peer_prep_params {
@@ -620,7 +662,7 @@ static int peer_prepare_switchmsg(char *msg, size_t size, struct peer_prep_param
 
 	/* encode table type */
 
-	intencode(st->table->type, &cursor);
+	intencode(peer_net_key_type[st->table->type], &cursor);
 
 	/* encode table key size */
 	intencode(st->table->key_size, &cursor);
@@ -1655,7 +1697,7 @@ static inline int peer_treat_definemsg(struct appctx *appctx, struct peer *p,
 	if (!*msg_cur)
 		goto malformed_exit;
 
-	if (p->remote_table->table->type != table_type
+	if (p->remote_table->table->type != peer_int_key_type[table_type]
 		|| p->remote_table->table->key_size != table_keylen) {
 		p->remote_table = NULL;
 		goto ignore_msg;
-- 
2.17.1