common/msg_queue: send backtrace on oversize queues.
Scary looking, but great for debugging! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
#include <assert.h>
|
||||
#include <ccan/cast/cast.h>
|
||||
#include <ccan/membuf/membuf.h>
|
||||
#include <common/daemon.h>
|
||||
#include <common/msg_queue.h>
|
||||
#include <common/utils.h>
|
||||
#include <wire/wire.h>
|
||||
|
||||
static bool warned_once;
|
||||
|
||||
struct msg_queue {
|
||||
bool fd_passing;
|
||||
MEMBUF(const u8 *) mb;
|
||||
@@ -60,6 +63,12 @@ static void do_enqueue(struct msg_queue *q, const u8 *add TAKES)
|
||||
|
||||
*msg = tal_dup_talarr(q, u8, add);
|
||||
|
||||
if (!warned_once && msg_queue_length(q) > 100000) {
|
||||
/* Can cause re-entry, so set flag first! */
|
||||
warned_once = true;
|
||||
send_backtrace("excessive queue length");
|
||||
}
|
||||
|
||||
/* In case someone is waiting */
|
||||
io_wake(q);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user