diff --git a/include/haproxy/debug.h b/include/haproxy/debug.h index b7a2e2072..f01441c9f 100644 --- a/include/haproxy/debug.h +++ b/include/haproxy/debug.h @@ -27,7 +27,6 @@ struct buffer; extern unsigned int debug_commands_issued; void ha_task_dump(struct buffer *buf, const struct task *task, const char *pfx); void ha_thread_dump_one(int thr, int from_signal); -void ha_thread_dump(struct buffer *buf, int thr); void ha_dump_backtrace(struct buffer *buf, const char *prefix, int dump); void ha_backtrace_to_stderr(void); void ha_panic(void); diff --git a/src/debug.c b/src/debug.c index 55b1744ba..3395150af 100644 --- a/src/debug.c +++ b/src/debug.c @@ -416,15 +416,6 @@ void ha_thread_dump_done(struct buffer *buf, int thr) } while (!HA_ATOMIC_CAS(&ha_thread_ctx[thr].thread_dump_buffer, &old, buf)); } -/* performs a complete thread dump: calls the remote thread and marks the - * buffer as read. - */ -void ha_thread_dump(struct buffer *buf, int thr) -{ - ha_thread_dump_fill(buf, thr); - ha_thread_dump_done(NULL, thr); -} - /* dumps into the buffer some information related to task (which may * either be a task or a tasklet, and prepend each line except the first one * with . The buffer is only appended and the first output starts by the @@ -519,11 +510,12 @@ static int cli_io_handler_show_threads(struct appctx *appctx) do { chunk_reset(&trash); - ha_thread_dump(&trash, *thr); - - if (applet_putchk(appctx, &trash) == -1) { - /* failed, try again */ - return 0; + if (ha_thread_dump_fill(&trash, *thr)) { + ha_thread_dump_done(NULL, *thr); + if (applet_putchk(appctx, &trash) == -1) { + /* failed, try again */ + return 0; + } } (*thr)++; } while (*thr < global.nbthread); @@ -686,8 +678,10 @@ void ha_panic() chunk_appendf(&trash, "Thread %u is about to kill the process.\n", tid + 1); for (thr = 0; thr < global.nbthread; thr++) { - ha_thread_dump(&trash, thr); + if (!ha_thread_dump_fill(&trash, thr)) + continue; DISGUISE(write(2, trash.area, trash.data)); + ha_thread_dump_done(NULL, thr); b_force_xfer(buf, &trash, b_room(buf)); chunk_reset(&trash); }