Re: Server crash due to SIGBUS(Bus Error) when trying to access the memory created using dsm_create().

Claudio Freire <klaussfreire@gmail.com>

From: Claudio Freire <klaussfreire@gmail.com>
To: "sul_amul@yahoo.co.in" <sul_amul@yahoo.co.in>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2016-08-12T17:05:22Z
Lists: pgsql-hackers
On Fri, Aug 12, 2016 at 1:55 PM, amul sul <sul_amul@yahoo.co.in> wrote:
> No segfault during dsm_create,  mmap returns  the memory address  which is
> inaccessible.
>
> Let me see how can I disable kernel overcommit behaviour, but  IMHO,  we
> should prevent ourselves from crashing,  shouldn't we?

Overcommit can be caught at dsm_create time with an mlock call (note,
that MAP_LOCKED isn't the same). Even a transient lock (mlock +
munlock) could prevent sigbus due to overcommit.


Commits

  1. Fix failure-to-read-man-page in commit 899bd785c.

  2. Avoid SIGBUS on Linux when a DSM memory request overruns tmpfs.