will keep their own copy of their own dump so that it can be later found in
the core file for inspection.
+A copy of the last valid thread_dump_buffer used is kept in last_dump_buffer,
+for easier post-mortem analysis. This one may be NULL or even invalid, but
+usually during a panic it will be valid, and may reveal useful hints even if it
+still contains the dump of the last warning. Usually this will point to a trash
+buffer or to stack area.
+
ha_thread_dump_fill() then either directly calls ha_thread_dump_one() if the
target thread is the current thread, or sends the target thread DEBUGSIG
(SIGURG) if it's a different thread. This signal is initialized at boot time
unsigned long long out_bytes; /* total #of bytes emitted */
unsigned long long spliced_out_bytes; /* total #of bytes emitted though a kernel pipe */
struct buffer *thread_dump_buffer; /* NULL out of dump, 0x02=to alloc, valid during a dump, |0x01 once done */
+ struct buffer *last_dump_buffer; /* Copy of last buffer used for a dump; may be NULL or invalid; for post-mortem only */
unsigned long long total_streams; /* Total number of streams created on this thread */
unsigned int stream_cnt; /* Number of streams attached to this thread */
unsigned long long n = now_cpu_time_thread(thr);
int stuck = !!(ha_thread_ctx[thr].flags & TH_FL_STUCK);
+ /* keep a copy of the dump pointer for post-mortem analysis */
+ HA_ATOMIC_STORE(&ha_thread_ctx[thr].last_dump_buffer, buf);
+
chunk_appendf(buf,
"%c%cThread %-2u: id=0x%llx act=%d glob=%d wq=%d rq=%d tl=%d tlsz=%d rqsz=%d\n"
" %2u/%-2u stuck=%d prof=%d",