From 050bc434267032c60bc93531f9c508a49a2a50e1 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 1 May 2020 16:57:02 +0200 Subject: [PATCH] MINOR: stream: report the list of active filters on stream crashes 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= 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. (cherry picked from commit 9753d61288936db804628c1e0bad20b7593ad384) Signed-off-by: Willy Tarreau --- src/stream.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/stream.c b/src/stream.c index 2dd7141..e320951 100644 --- a/src/stream.c +++ b/src/stream.c @@ -3158,6 +3158,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 " -- 1.7.10.4