Re: patch: prevent user from setting wal_buffers over 2GB bytes

From: Takashi Horikawa <t-horikawa(at)aj(dot)jp(dot)nec(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: patch: prevent user from setting wal_buffers over 2GB bytes
Date: 2015-08-04 04:01:13
Message-ID: 73FA3881462C614096F815F75628AFCD03539E1B@BPXM01GP.gisp.nec.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> >> Why does this cause a core dump? We could consider fixing whatever
> >> the problem is rather than capping the value.
As far as I experiment with my own evaluation environment using
PostgreSQL-9.4.4 on a x86_64 Linux, this problem can be fixed with the patch
attached.

I have confirmed that applying the patch makes 'wal_buffers = 4GB' works
fine, while original PostgreSQL-9.4.4 results in core dump (segfault). I'll be
happy if anyone reconfirm this.

--
Takashi Horikawa
NEC Corporation
Knowledge Discovery Research Laboratories

> -----Original Message-----
> From: pgsql-hackers-owner(at)postgresql(dot)org
> [mailto:pgsql-hackers-owner(at)postgresql(dot)org] On Behalf Of Robert Haas
> Sent: Tuesday, August 04, 2015 2:29 AM
> To: Josh Berkus
> Cc: PostgreSQL-development
> Subject: Re: [HACKERS] patch: prevent user from setting wal_buffers over
> 2GB bytes
>
> On Fri, Jul 31, 2015 at 8:09 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> > On 07/31/2015 10:43 AM, Robert Haas wrote:
> >> On Thu, Jul 30, 2015 at 9:17 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> >>> In guc.c, the maximum for wal_buffers is INT_MAX. However,
> >>> wal_buffers is actually measured in 8KB buffers, not in bytes. This
> >>> means that users are able to set wal_buffers > 2GB. When the
> >>> database is started, this can cause a core dump if the WAL offset is
> > 2GB.
> >>
> >> Why does this cause a core dump? We could consider fixing whatever
> >> the problem is rather than capping the value.
> >
> > The underlying issue is that byte position in wal_buffers is a 32-bit
> > INT, so as soon as you exceed that, core dump.
>
> OK. So capping it sounds like the right approach, then.
>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL
> Company
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers

Attachment Content-Type Size
allow_wal_buffer_over_2G.patch application/octet-stream 830 bytes
smime.p7s application/pkcs7-signature 6.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2015-08-04 04:41:26 Re: max_worker_processes on the standby
Previous Message Amit Kapila 2015-08-04 03:15:11 Re: Re: [COMMITTERS] pgsql: Map basebackup tablespaces using a tablespace_map file