Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1bf4a84

Browse files
committed
Skip dead backends in MinimumActiveBackends
Back ined0b409, PGPROC was split and moved to static variables inprocarray.c, with procs in ProcArrayStruct replaced by an array ofintegers representing process numbers (pgprocnos), with -1 indicating adead process which has yet to be removed. Access to procArray isgenerally done under ProcArrayLock and therefore most code does not haveto concern itself with -1 entries.However, MinimumActiveBackends intentionally does not takeProcArrayLock, which means it has to be extra careful when accessingprocArray. Prior toed0b409, this was handled by checking for a NULLin the pointer array, but that check was no longer valid after thesplit. Coverity pointed out that the check could never happen and soit was removed in5592eba. That didn't make anything worse, but itdidn't fix the issue either.The correct fix is to check for pgprocno == -1 and skip over that entryif it is encountered.Back-patch to 9.2, since there can be attempts to access the arraysprior to their start otherwise. Note that the changes prior to 9.4 willlook a bit different due to the change in5592eba.Note that MinimumActiveBackends only returns a bool for heuristicpurposes and any pre-array accesses are strictly read-only and so thereis no security implication and the lack of fields complaints indicatesit's very unlikely to run into issues due to this.Pointed out by Noah.
1 parent44096f1 commit1bf4a84

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

‎src/backend/storage/ipc/procarray.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,6 +2466,8 @@ MinimumActiveBackends(int min)
24662466
* free list and are recycled. Its contents are nonsense in that case,
24672467
* but that's acceptable for this function.
24682468
*/
2469+
if (pgprocno==-1)
2470+
continue;/* do not count deleted entries */
24692471
if (proc==MyProc)
24702472
continue;/* do not count myself */
24712473
if (pgxact->xid==InvalidTransactionId)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp