Skip to content

Conversation

@pgguru
Copy link
Collaborator

@pgguru pgguru commented Oct 1, 2025

Be explicit about using TopMemoryContext for the _PG_init() GUC setup memory context; it looks like there are cases that the strings can be deallocated.

This was showing up in crashes in a SHOW ALL output:

#2  0x0000000000a8e58c in ShowAllGUCConfig (dest=<optimized out>) at utils/misc/guc_funcs.c:510
510                             values[2] = PointerGetDatum(cstring_to_text(conf->short_desc));
(gdb) p conf
$1 = (struct config_generic *) 0x2c98580
(gdb) p *conf
$2 = {name = 0x2c98688 "pg_parquet.enable_copy_hooks", context = PGC_USERSET, group = CUSTOM_OPTIONS,
  short_desc = 0x7f9f3f246120 <error: Cannot access memory at address 0x7f9f3f246120>,
  long_desc = 0x7f9f3f246148 <error: Cannot access memory at address 0x7f9f3f246148>, flags = 0, vartype = PGC_BOOL, status = 0, source = PGC_S_FILE,
  reset_source = PGC_S_FILE, scontext = PGC_POSTMASTER, reset_scontext = PGC_POSTMASTER, srole = 10, reset_srole = 10, stack = 0x0, extra = 0x0, nondef_link = {
    prev = 0x2c5a418, next = 0x2c98c60}, stack_link = {next = 0x0}, report_link = {next = 0x0}, last_reported = 0x0,
  sourcefile = 0x2c986b0 "/var/lib/pgsql/17/data/postgresql.conf", sourceline = 52}
(gdb) p *conf->short_desc
Cannot access memory at address 0x7f9f3f246120

@pgguru pgguru requested a review from aykut-bozkurt October 1, 2025 14:59
@codecov
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.30%. Comparing base (dcf6fc0) to head (cb48d8a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #165   +/-   ##
=======================================
  Coverage   91.30%   91.30%           
=======================================
  Files          97       97           
  Lines       11204    11206    +2     
=======================================
+ Hits        10230    10232    +2     
  Misses        974      974           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pgguru pgguru merged commit 7b113c6 into main Oct 1, 2025
14 checks passed
@pgguru pgguru deleted the pgguru/guc-top-mem-context branch October 1, 2025 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants