Hi,
While testing v4, I ran into a backend startup failure when
wait_event_capture=stats was set through PGOPTIONS:
FATAL: ResourceOwnerEnlarge called after release started
This was on macOS arm64 with --enable-wait-event-timing,
--enable-cassert and --enable-debug. I ran a one-statement pgbench
workload with two clients (-c 2 -j 2 -t 1) 500 times. 16 runs
returned non-zero, and five runs produced the FATAL above in the
server log.
The failure is probabilistic. The same test did not reproduce with
one client in 500 runs. The two-client tests with
wait_event_capture=off or trace at startup, and with stats or trace set
after connection startup, were also clean.
The relevant part of the backtrace was:
InitPostgres
-> CommitTransactionCommand
-> ProcReleaseLocks
-> LockReleaseAll
-> LWLockAcquire
-> pgstat_report_wait_end_timing
-> pgstat_wait_event_timing_lazy_attach
-> wait_event_timing_attach_array
-> wait_event_timing_ensure_dsa
-> dsa_attach
-> dsm_attach
-> dsm_create_descriptor
-> ResourceOwnerEnlarge
The first lazy DSA attach is reached from the wait-end path while
InitPostgres is already releasing the current resource owner. The
attach path then reaches dsm_create_descriptor(), which calls
ResourceOwnerEnlarge() after release has started.
Could you address this in the next version?
Regards,
Ilmar
The new status of this patch is: Waiting on Author