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

Commit930a67a

Browse files
author
Valeriy Zainullin
committed
Check collector has started in pg_wait_sampling_reset_profile.
The worker might have not started yet or it may never start,because its registration was cancelled due to worker limit.This commit adds a check for NULL value of pgws_collector_hdr->latch.The previous usage in pg_wait_sampling.c has such a check, weshould do the same here.
1 parentfafeda0 commit930a67a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎pg_wait_sampling.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,10 @@ receive_array(SHMRequest request, Size item_size, Size *count)
649649
pgws_collector_hdr->request=request;
650650
LockRelease(&collectorTag,ExclusiveLock, false);
651651

652+
/*
653+
* Check that the collector was started to avoid NULL
654+
* pointer dereference.
655+
*/
652656
if (!pgws_collector_hdr->latch)
653657
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
654658
errmsg("pg_wait_sampling collector wasn't started")));
@@ -819,6 +823,14 @@ pg_wait_sampling_reset_profile(PG_FUNCTION_ARGS)
819823
pgws_collector_hdr->request=PROFILE_RESET;
820824
LockRelease(&collectorTag,ExclusiveLock, false);
821825

826+
/*
827+
* Check that the collector was started to avoid NULL
828+
* pointer dereference.
829+
*/
830+
if (!pgws_collector_hdr->latch)
831+
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
832+
errmsg("pg_wait_sampling collector wasn't started")));
833+
822834
SetLatch(pgws_collector_hdr->latch);
823835

824836
LockRelease(&queueTag,ExclusiveLock, false);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp