Skip to content

Commit c45b1d2

Browse files
committed
Fix initialization of dsa.c free area counter.
The backend local copy of dsa_area_control->freed_segment_counter was not properly initialized / maintained. This could, if unlucky, lead to keeping attached to a segment for too long. Found via valgrind bleat on buildfarm animal skink. Author: Thomas Munro Discussion: https://postgr.es/m/20170407164935.obsf2jipjfos5zei@alap3.anarazel.de
1 parent 8f0530f commit c45b1d2

File tree

1 file changed

+2
-0
lines changed
  • src/backend/utils/mmgr

1 file changed

+2
-0
lines changed

src/backend/utils/mmgr/dsa.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,7 @@ create_internal(void *place, size_t size,
12441244
area->mapping_pinned = false;
12451245
memset(area->segment_maps, 0, sizeof(dsa_segment_map) * DSA_MAX_SEGMENTS);
12461246
area->high_segment_index = 0;
1247+
area->freed_segment_counter = 0;
12471248
LWLockInitialize(&control->lock, control->lwlock_tranche_id);
12481249
for (i = 0; i < DSA_NUM_SIZE_CLASSES; ++i)
12491250
LWLockInitialize(DSA_SCLASS_LOCK(area, i),
@@ -1322,6 +1323,7 @@ attach_internal(void *place, dsm_segment *segment, dsa_handle handle)
13221323
errmsg("could not attach to dynamic shared area")));
13231324
}
13241325
++control->refcnt;
1326+
area->freed_segment_counter = area->control->freed_segment_counter;
13251327
LWLockRelease(DSA_AREA_LOCK(area));
13261328

13271329
return area;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy