Re: BUG #16160: Minor memory leak in case of starting postgres server with SSL encryption

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jelte Fennema <postgres(at)jeltef(dot)nl>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, duspensky(at)ya(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16160: Minor memory leak in case of starting postgres server with SSL encryption
Date: 2021-03-16 17:36:24
Message-ID: 3345317.1615916184@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Jelte Fennema <postgres(at)jeltef(dot)nl> writes:
> I'm pretty sure it was the only cause in this specific case. When running
> postgres with valgrind this was the only block that was repeatedly being
> leaked.

Yeah, after doing some testing locally it seems that the non-error path,
at least, is free of additional problems. I set up a shell loop to hit
the postmaster with SIGHUP ten times a second. Looking at v12, an
ssl-enabled postmaster leaks very visibly after a few moments; while
there's no detectable leak in HEAD. So +1 for back-patching the DH_free
fix. (Michael, do you want to do the honors?)

> Looking at it again now, I see that if an error occurs when parsing
> ssl_crl_file the root_cert_list is in fact leaked. This was easy to
> reproduce by specifying a bogus path for ssl_crl_file.

Interesting. While this case doesn't seem likely to pose much of a
practical problem, maybe we should clean it up. I'd already wondered
what was the point of separating the creation and use of the
root_cert_list by so much --- seems like we could install it
immediately after creation.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2021-03-16 18:01:09 Re: BUG #16160: Minor memory leak in case of starting postgres server with SSL encryption
Previous Message Jelte Fennema 2021-03-16 17:17:49 Re: BUG #16160: Minor memory leak in case of starting postgres server with SSL encryption