pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #16666: Slight memory leak when running pg_ctl reload
4+ messages / 3 participants
[nested] [flat]
Commits from this thread:
2020-10-12 397ea901e8 f35c117700 cfa4cff30c c7573ab1ec 43ca5e07d1 a5c77e6b8c 9343bfefa4 Fix memory leak when guc.c decides a setting can't be applied now.
* BUG #16666: Slight memory leak when running pg_ctl reload
@ 2020-10-12 13:32 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 2 replies; 4+ messages in thread
From: PG Bug reporting form @ 2020-10-12 13:32 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: bchen90@163.com
The following bug has been logged on the website:
Bug reference: 16666
Logged by: BoChen
Email address: bchen90@163.com
PostgreSQL version: 11.8
Operating system: SUSE Linux Enterprise Server 11 (x86_64)
Description:
I found slighting memory leakage occured when running pg_ctl reload command
for the following code segment(guc.c:6726-6740). When runing 'pg_ctl
reload', for these string type PGC_POSTMASTER GUC variables like
'unix_socket_directories', the following code segment will leak newval's
memery.
if (prohibitValueChange)
{
/* newval shouldn't be NULL, so we're a bit sloppy here */
if (*conf->variable == NULL || newval == NULL ||
strcmp(*conf->variable, newval) != 0)
{
record->status |= GUC_PENDING_RESTART;
ereport(elevel,
(errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
errmsg("parameter \"%s\" cannot be changed without restarting the
server",
name)));
return 0;
}
record->status &= ~GUC_PENDING_RESTART;
return -1;
}
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #16666: Slight memory leak when running pg_ctl reload
@ 2020-10-12 14:19 Bruce Momjian <bruce@momjian.us>
parent: PG Bug reporting form <noreply@postgresql.org>
1 sibling, 1 reply; 4+ messages in thread
From: Bruce Momjian @ 2020-10-12 14:19 UTC (permalink / raw)
To: bchen90@163.com; pgsql-bugs@lists.postgresql.org
On Mon, Oct 12, 2020 at 01:32:13PM +0000, PG Bug reporting form wrote:
> The following bug has been logged on the website:
>
> Bug reference: 16666
> Logged by: BoChen
> Email address: bchen90@163.com
> PostgreSQL version: 11.8
> Operating system: SUSE Linux Enterprise Server 11 (x86_64)
> Description:
>
> I found slighting memory leakage occured when running pg_ctl reload command
> for the following code segment(guc.c:6726-6740). When runing 'pg_ctl
> reload', for these string type PGC_POSTMASTER GUC variables like
> 'unix_socket_directories', the following code segment will leak newval's
> memery.
Uh, you are saying pg_ctl leaks memory or the database server leaks
memory? I don't see any memory allocation in the code you posted.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #16666: Slight memory leak when running pg_ctl reload
@ 2020-10-12 14:42 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2020-10-12 14:42 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: bchen90@163.com; pgsql-bugs@lists.postgresql.org
Bruce Momjian <bruce@momjian.us> writes:
> Uh, you are saying pg_ctl leaks memory or the database server leaks
> memory? I don't see any memory allocation in the code you posted.
I've not looked at the code yet, but I think the OP is worried that
we need to free(newval) before these "return"s.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #16666: Slight memory leak when running pg_ctl reload
@ 2020-10-12 17:37 Tom Lane <tgl@sss.pgh.pa.us>
parent: PG Bug reporting form <noreply@postgresql.org>
1 sibling, 0 replies; 4+ messages in thread
From: Tom Lane @ 2020-10-12 17:37 UTC (permalink / raw)
To: bchen90@163.com; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> I found slighting memory leakage occured when running pg_ctl reload command
> for the following code segment(guc.c:6726-6740). When runing 'pg_ctl
> reload', for these string type PGC_POSTMASTER GUC variables like
> 'unix_socket_directories', the following code segment will leak newval's
> memery.
Yeah, you're right. If there's a "newextra" chunk, that'll get
leaked too.
Even counting that, it's not very plausible that one would SIGHUP a
server often enough that the bloat would become obvious, since these
values typically aren't very large. But it's clearly a bug.
Patch applied, thanks for the report!
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2020-10-12 17:37 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12 13:32 BUG #16666: Slight memory leak when running pg_ctl reload PG Bug reporting form <noreply@postgresql.org>
2020-10-12 14:19 ` Bruce Momjian <bruce@momjian.us>
2020-10-12 14:42 ` Re: BUG #16666: Slight memory leak when running pg_ctl reload Tom Lane <tgl@sss.pgh.pa.us>
2020-10-12 17:37 ` Re: BUG #16666: Slight memory leak when running pg_ctl reload Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox