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

Commit4c1ae7a

Browse files
authored
Merge pull request#52 from postgrespro/PGPRO-6599
PGPRO-6599: Avoid race when accessing the request shared variable.
2 parents9dad24b +2d38a79 commit4c1ae7a

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

‎collector.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,12 @@ collector_main(Datum main_arg)
441441
if (collector_hdr->request!=NO_REQUEST)
442442
{
443443
LOCKTAGtag;
444-
SHMRequestrequest=collector_hdr->request;
444+
SHMRequestrequest;
445445

446446
init_lock_tag(&tag,PGWS_COLLECTOR_LOCK);
447447

448448
LockAcquire(&tag,ExclusiveLock, false, false);
449+
request=collector_hdr->request;
449450
collector_hdr->request=NO_REQUEST;
450451

451452
if (request==HISTORY_REQUEST||request==PROFILE_REQUEST)

‎pg_wait_sampling.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,13 +594,11 @@ receive_array(SHMRequest request, Size item_size, Size *count)
594594
init_lock_tag(&queueTag,PGWS_QUEUE_LOCK);
595595
LockAcquire(&queueTag,ExclusiveLock, false, false);
596596

597-
/* Ensure collector has processed previous request */
598597
init_lock_tag(&collectorTag,PGWS_COLLECTOR_LOCK);
599598
LockAcquire(&collectorTag,ExclusiveLock, false, false);
600-
LockRelease(&collectorTag,ExclusiveLock, false);
601-
602599
recv_mq=shm_mq_create(collector_mq,COLLECTOR_QUEUE_SIZE);
603600
collector_hdr->request=request;
601+
LockRelease(&collectorTag,ExclusiveLock, false);
604602

605603
if (!collector_hdr->latch)
606604
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
@@ -770,9 +768,9 @@ pg_wait_sampling_reset_profile(PG_FUNCTION_ARGS)
770768

771769
init_lock_tag(&tagCollector,PGWS_COLLECTOR_LOCK);
772770
LockAcquire(&tagCollector,ExclusiveLock, false, false);
771+
collector_hdr->request=PROFILE_RESET;
773772
LockRelease(&tagCollector,ExclusiveLock, false);
774773

775-
collector_hdr->request=PROFILE_RESET;
776774
SetLatch(collector_hdr->latch);
777775

778776
LockRelease(&tag,ExclusiveLock, false);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp