Re: [BUG] Re-entering malloc problem when use --enable-nls build postgresql

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 158306855 <anderson2013(at)qq(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: [BUG] Re-entering malloc problem when use --enable-nls build postgresql
Date: 2018-05-08 19:51:57
Message-ID: 20180508195157.etrkobpoon6bxmu6@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2018-05-08 01:36:31 -0700, Andres Freund wrote:
> On 2018-05-08 02:07:08 -0400, Tom Lane wrote:
> > Andres Freund <andres(at)anarazel(dot)de> writes:
> > > On 2018-05-08 01:32:33 -0400, Tom Lane wrote:
> > >> There are not any better alternatives. We can't just set a flag in the
> > >> signal handler and hope that control will someday reach a place that
> > >> notices the flag. We could exit without attempting to report anything,
> > >> but nobody would find that user-friendly. So we try to report, in the
> > >> full understanding that sometimes it won't work.
> >
> > > It'd be fairly unproblematic to write an untranslated message out.
> >
> > To stderr, maybe. Across an SSL-encrypted client connection? You're
> > dreaming.
>
> libpq invents an equivalent message when the server closes the
> connection anyway, IIRC. So that'd not necessarily be too bad.

Oh, also: It looks like it'd actually be relatively easy to give openssl
its own memory allocator + pool:
Create a global 'openssl' memory context with preallocation, use
CRYPTO_set_mem_functions() to make openssl allocations go through small
wrapper functions around palloc/repalloc/pfree.

It's still not entirely kosher to call into openssl from a signal
handler because we could be inside openssl - but the window for that is
a lot smaller than being inside *any* memory allocation.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2018-05-08 21:30:58 Re: [BUG] Re-entering malloc problem when use --enable-nls build postgresql
Previous Message Tom Lane 2018-05-08 19:10:01 Re: BUG #15190: Build configure should have option to disable clock_gettime on MacOS 10.12 and up.