Description
Starting from commit postgres/postgres@cdbc0ca48ca shared preload libraries are become to initialize before MaxBackends
global variable setup. This might lead to invalid calculation of requested shared memory size if this calculation is based on max number of possible backend processes in postgres instance. For pg_wait_sampling
module the size calculation of queryId shared memory follows this rule, i.e. it uses MaxBackends
value. As result, for this shared memory fragment we request zero size (UPD. not zero but NUM_AUXILIARY_PROCS + max_prepared_xacts size) but later we assign non-zero memory (with already initialized MaxBackends
value) for this purpose. Such behavior might incur future occurrences of out of shared memory
errors.
The hackers thread have to help in finding of possible solution.