From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Mikhail Kot <mikhail(dot)kot(at)databricks(dot)com> |
Cc: | "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Rider <oceanustz(at)gmail(dot)com>, Steven Niu <niushiji(at)gmail(dot)com> |
Subject: | Re: 回复: Fix segfault while accessing half-initialized hash table in pgstat_shmem.c |
Date: | 2025-09-08 07:54:16 |
Message-ID: | aL6LqMup8ykgRh6w@paquier.xyz |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Sep 06, 2025 at 10:01:24AM +0900, Michael Paquier wrote:
> A last thing that I was not able to spend much time on is how much it
> is possible to mess up with the shared memory state. If it is worse
> than I suspected initially, where an OOM in a first session can cause
> crashes because of incorrect dshash entries in shmem depending on the
> stats kind fetched, a backpatch will be required, indeed. The change
> is not really invasive, so that's OK on this side.
OK, I have played a bit more with all that, corrupting the shared
hashtable of pgstats. At the end, I have used a version close to what
I have sent previously that changes pgstat_init_entry() to return NULL
on OOM with dsa_allocate_extended(), as any other possible errors that
could happen in this call involve elog(ERROR) and not-reachable cases.
pgstat_read_statsfile() has been changed to raise an ERROR instead,
which is what we did previously, giving priority to the on-disk stats
when the environment is under memory pressure at startup. The patch
has required a few tweaks in the back-branches, nothing huge.
Thanks for the report!
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Eric Marsden | 2025-09-08 08:01:00 | doc patch: protocol major.minor numbers in NegotiateProtocolVersion message |
Previous Message | Dean Rasheed | 2025-09-08 07:20:40 | Re: Add xicorr(X, Y): support for the xi (ξ) correlation coefficient by Chatterjee |