Closed shinderuk closed 2 years ago
Good catch! Thanks for the issue. Generally, such asynchronous behavior of collector and requesting process might incur different failures.
PR https://github.com/postgrespro/pg_wait_sampling/pull/52 resolves this issue. Placing acquiring of collector lock before reading of collector_hdr->request
would allow to complete history request, that from collector's side will fail on message queue, before backend initiating profile request will get progress (it will block on collector lock). If profile request gets progress before acquiring of collector lock then collector_hdr->request
variable will be rewritten before collector read this value and as result history request will be ignored.
Consider the following scenario:
Stop the collector just before
LockAcquire(&tag, ExclusiveLock, false, false);
in collector_main (collector.c:442).Session 1:
Terminate the backend while it is waiting for collector (with kill or pg_terminate_backend).
Session 2:
After sending the query let the collector continue.