]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream: report the list of active filters on stream crashes
authorWilly Tarreau <w@1wt.eu>
Fri, 1 May 2020 14:57:02 +0000 (16:57 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 1 May 2020 15:01:59 +0000 (17:01 +0200)
Now we very rarely catch spinning streams, and whenever we catch one it
seems a filter is involved, but we currently report no info about them.
Let's print the list of enabled filters on the stream with such a crash
to help with the reports. A typical output will now look like this:

  [ALERT] 121/165908 (1110) : A bogus STREAM [0x7fcaf4016a60] is spinning at 2 calls per second and refuses to die, aborting now! Please report this error to developers [strm=0x7fcaf4016a60 src=127.0.0.1 fe=l1 be=l1 dst=<CACHE> rqf=6dc42000 rqa=48000 rpf=a0040223 rpa=24000000 sif=EST,10008 sib=DIS,80110 af=(nil),0 csf=0x7fcaf4023c00,10c000 ab=0x7fcaf40235f0,4 csb=(nil),0 cof=0x7fcaf4016610,1300:H1(0x7fcaf4016840)/RAW((nil))/tcpv4(29) cob=(nil),0:NONE((nil))/NONE((nil))/NONE(0) filters={0x7fcaf4016fb0="cache store filter", 0x7fcaf4017080="compression filter"}]

This may be backported to 2.0.

src/stream.c

index 8b9d885e745c49625321be98f1d62f6c5653b098..4822387d61b39d5cf2c64af660064cb8c28590cc 100644 (file)
@@ -2666,6 +2666,19 @@ void stream_dump_and_crash(enum obj_type *obj, int rate)
 
        chunk_reset(&trash);
        stream_dump(&trash, s, "", ' ');
+
+       chunk_appendf(&trash, "filters={");
+       if (HAS_FILTERS(s)) {
+               struct filter *filter;
+
+               list_for_each_entry(filter, &s->strm_flt.filters, list) {
+                       if (filter->list.p != &s->strm_flt.filters)
+                               chunk_appendf(&trash, ", ");
+                       chunk_appendf(&trash, "%p=\"%s\"", filter, FLT_ID(filter));
+               }
+       }
+       chunk_appendf(&trash, "}");
+
        memprintf(&msg,
                  "A bogus %s [%p] is spinning at %d calls per second and refuses to die, "
                  "aborting now! Please report this error to developers "