]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add a debug counter for sendto() errors
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 3 May 2022 08:32:21 +0000 (10:32 +0200)
committerFrédéric Lécaille <flecaille@haproxy.com>
Thu, 12 May 2022 13:11:53 +0000 (15:11 +0200)
As we do not have any task to be wake up by the poller after sendto() error,
we add an sendto() error counter to the quic_conn struct.
Dump its values from qc_send_ppkts().

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

index a983733941063a2cf52d0c6fe895e93acf0be6fa..504294f1210d92af04b931b90fb9de0db541785e 100644 (file)
@@ -778,6 +778,7 @@ struct quic_conn {
        unsigned int nb_pkt_since_cc;
 
        const struct qcc_app_ops *app_ops;
+       unsigned int sendto_err;
 };
 
 #endif /* USE_QUIC */
index a0f8129f49e8fdda555194b0ccfedcd0858f1e08..2cc5a7f0332a66643c662b58a6736a5d23305399 100644 (file)
@@ -341,11 +341,11 @@ size_t qc_snd_buf(struct quic_conn *qc, const struct buffer *buf, size_t count,
                }
                else if (ret == 0 || errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOTCONN || errno == EINPROGRESS) {
                        /* TODO must be handle properly. It is justified for UDP ? */
-                       ABORT_NOW();
+                       qc->sendto_err++;
                }
                else if (errno != EINTR) {
                        /* TODO must be handle properly. It is justified for UDP ? */
-                       ABORT_NOW();
+                       qc->sendto_err++;
                }
        }
 
index 524c42d2e1d40ae4005e02cc86228f8e9e80c0cb..ffdbe771a7e65933ec7c99a9a29ffaf9133d77b8 100644 (file)
@@ -552,7 +552,7 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
                if (mask & QUIC_EV_CONN_SPPKTS) {
                        const struct quic_tx_packet *pkt = a2;
 
-                       chunk_appendf(&trace_buf, " cwnd=%llu ppif=%llu pif=%llu",
+                       chunk_appendf(&trace_buf, " err=%u cwnd=%llu ppif=%llu pif=%llu", qc->sendto_err,
                                     (unsigned long long)qc->path->cwnd,
                                     (unsigned long long)qc->path->prep_in_flight,
                                     (unsigned long long)qc->path->in_flight);
@@ -3180,6 +3180,7 @@ int qc_send_ppkts(struct qring *qr, struct ssl_sock_ctx *ctx)
 
        qc = ctx->qc;
        cbuf = qr->cbuf;
+       TRACE_ENTER(QUIC_EV_CONN_SPPKTS, qc);
        while (cb_contig_data(cbuf)) {
                unsigned char *pos;
                struct buffer tmpbuf = { };
@@ -3256,6 +3257,8 @@ int qc_send_ppkts(struct qring *qr, struct ssl_sock_ctx *ctx)
                }
        }
 
+       TRACE_LEAVE(QUIC_EV_CONN_SPPKTS, qc);
+
        return 1;
 }
 
@@ -4392,6 +4395,7 @@ static struct quic_conn *qc_new_conn(unsigned int version, int ipv4,
 
        qc->streams_by_id = EB_ROOT_UNIQUE;
        qc->stream_buf_count = 0;
+       qc->sendto_err = 0;
 
        TRACE_LEAVE(QUIC_EV_CONN_INIT, qc);