From: Willy Tarreau Date: Tue, 18 Dec 2018 09:32:05 +0000 (+0100) Subject: MINOR: mux-h2: report more h2c, last h2s and cs information on "show fd" X-Git-Tag: v1.9.0~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=987c0633faa8b90902e97c63ade377343620638c;p=thirdparty%2Fhaproxy.git MINOR: mux-h2: report more h2c, last h2s and cs information on "show fd" Most of the time when we issue "show fd" to dump a mux's state, it's to figure why a transfer is frozen. Connection, stream and conn_stream states are critical there. And most of the time when this happens there is a single stream left in the H2 mux, so let's always dump the last known stream on show fd, as most of the time it will be the one of interest. --- diff --git a/src/mux_h2.c b/src/mux_h2.c index 619df62c36..33510dcab5 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -4844,7 +4844,7 @@ static size_t h2_snd_buf(struct conn_stream *cs, struct buffer *buf, size_t coun static void h2_show_fd(struct buffer *msg, struct connection *conn) { struct h2c *h2c = conn->mux_ctx; - struct h2s *h2s; + struct h2s *h2s = NULL; struct eb32_node *node; int fctl_cnt = 0; int send_cnt = 0; @@ -4869,12 +4869,28 @@ static void h2_show_fd(struct buffer *msg, struct connection *conn) node = eb32_next(node); } - chunk_appendf(msg, " st0=%d err=%d maxid=%d lastid=%d flg=0x%08x nbst=%u nbcs=%u" - " fctl_cnt=%d send_cnt=%d tree_cnt=%d orph_cnt=%d dbuf=%u/%u mbuf=%u/%u", + chunk_appendf(msg, " h2c.st0=%d .err=%d .maxid=%d .lastid=%d .flg=0x%04x" + " .nbst=%u .nbcs=%u .fctl_cnt=%d .send_cnt=%d .tree_cnt=%d" + " .orph_cnt=%d .sub=%d .dsi=%d .dbuf=%u@%p+%u/%u .msi=%d .mbuf=%u@%p+%u/%u", h2c->st0, h2c->errcode, h2c->max_id, h2c->last_sid, h2c->flags, h2c->nb_streams, h2c->nb_cs, fctl_cnt, send_cnt, tree_cnt, orph_cnt, - (unsigned int)b_data(&h2c->dbuf), (unsigned int)b_size(&h2c->dbuf), - (unsigned int)b_data(&h2c->mbuf), (unsigned int)b_size(&h2c->mbuf)); + h2c->wait_event.wait_reason, h2c->dsi, + (unsigned int)b_data(&h2c->dbuf), b_orig(&h2c->dbuf), + (unsigned int)b_head_ofs(&h2c->dbuf), (unsigned int)b_size(&h2c->dbuf), + h2c->msi, + (unsigned int)b_data(&h2c->mbuf), b_orig(&h2c->mbuf), + (unsigned int)b_head_ofs(&h2c->mbuf), (unsigned int)b_size(&h2c->mbuf)); + + if (h2s) { + chunk_appendf(msg, " last_h2s=%p .id=%d .flg=0x%04x .rxbuf=%u@%p+%u/%u .cs=%p", + h2s, h2s->id, h2s->flags, + (unsigned int)b_data(&h2s->rxbuf), b_orig(&h2s->rxbuf), + (unsigned int)b_head_ofs(&h2s->rxbuf), (unsigned int)b_size(&h2s->rxbuf), + h2s->cs); + if (h2s->cs) + chunk_appendf(msg, " .cs.flg=0x%08x .cs.data=%p", + h2s->cs->flags, h2s->cs->data); + } } /*******************************************************/