]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: do not crash on unhandled sendto error
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 24 Oct 2022 08:03:33 +0000 (10:03 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 24 Oct 2022 08:18:44 +0000 (10:18 +0200)
Remove ABORT_NOW() statement on unhandled sendto error. Instead use a
dedicated counter sendto_err_unknown to report these cases.

If we detect increment of this counter, strace can be used to detect
errno value :
  $ strace -p $(pidof haproxy) -f -e trace=sendto -Z

This should be backported up to 2.6.

This should help to debug github issue #1903.

include/haproxy/quic_stats-t.h
src/quic_sock.c

index 8a682285c7a9c30b01937babaa421de0a3efe4f3..707825e4ad5d1749d92933a409578fbee976ea89 100644 (file)
@@ -56,6 +56,7 @@ struct quic_counters {
        long long dropped_parsing;   /* total number of dropped packets upon parsing errors */
        long long socket_full;       /* total number of EAGAIN errors on sendto() calls */
        long long sendto_err;        /* total number of errors on sendto() calls, EAGAIN excepted */
+       long long sendto_err_unknown; /* total number of errors on sendto() calls which are currently not supported */
        long long lost_pkt;          /* total number of lost packets */
        long long too_short_initial_dgram; /* total number of too short datagrams with Initial packets */
        long long retry_sent;        /* total number of Retry sent */
index 8617489203ebbc08774fb1811ab5bfeacb467532..29f30ccbe03ec184b3cba0d373830079a6617806 100644 (file)
@@ -536,14 +536,14 @@ int qc_snd_buf(struct quic_conn *qc, const struct buffer *buf, size_t sz,
        } while (ret < 0 && errno == EINTR);
 
        if (ret < 0 || ret != sz) {
+               struct proxy *prx = qc->li->bind_conf->frontend;
+               struct quic_counters *prx_counters =
+                 EXTRA_COUNTERS_GET(prx->extra_counters_fe,
+                                    &quic_stats_module);
+
                /* TODO adjust errno for UDP context. */
                if (errno == EAGAIN || errno == EWOULDBLOCK ||
                    errno == ENOTCONN || errno == EINPROGRESS || errno == EBADF) {
-                       struct proxy *prx = qc->li->bind_conf->frontend;
-                       struct quic_counters *prx_counters =
-                         EXTRA_COUNTERS_GET(prx->extra_counters_fe,
-                                            &quic_stats_module);
-
                        if (errno == EAGAIN || errno == EWOULDBLOCK)
                                HA_ATOMIC_INC(&prx_counters->socket_full);
                        else
@@ -551,7 +551,7 @@ int qc_snd_buf(struct quic_conn *qc, const struct buffer *buf, size_t sz,
                }
                else if (errno) {
                        /* TODO unlisted errno : handle it explicitly. */
-                       ABORT_NOW();
+                       HA_ATOMIC_INC(&prx_counters->sendto_err_unknown);
                }
 
                return 1;