mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-10 06:12:45 +02:00
DEBUG: pools: detect that malloc_trim() is in progress
Now when calling ha_panic() with a thread still under malloc_trim(), we'll set a new tainted flag to easily report it, and the output trace will report that this condition happened and will suggest to use no-memory-trimming to avoid it in the future.
This commit is contained in:
12
src/debug.c
12
src/debug.c
@@ -240,6 +240,10 @@ void ha_thread_dump_one(int thr, int from_signal)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (HA_ATOMIC_LOAD(&pool_trim_in_progress))
|
||||
mark_tainted(TAINTED_MEM_TRIMMING_STUCK);
|
||||
|
||||
/* We only emit the backtrace for stuck threads in order not to
|
||||
* waste precious output buffer space with non-interesting data.
|
||||
* Please leave this as the last instruction in this function
|
||||
@@ -468,6 +472,14 @@ void ha_panic()
|
||||
DISGUISE(write(2, trash.area, trash.data));
|
||||
}
|
||||
#endif
|
||||
if (get_tainted() & TAINTED_MEM_TRIMMING_STUCK) {
|
||||
chunk_printf(&trash,
|
||||
"### Note: one thread was found stuck under malloc_trim(), which can run for a\n"
|
||||
" very long time on large memory systems. You way want to disable this\n"
|
||||
" memory reclaiming feature by setting 'no-memory-trimming' in the\n"
|
||||
" 'global' section of your configuration to avoid this in the future.\n");
|
||||
DISGUISE(write(2, trash.area, trash.data));
|
||||
}
|
||||
|
||||
for (;;)
|
||||
abort();
|
||||
|
||||
Reference in New Issue
Block a user