Re: Server crash due to SIGBUS(Bus Error) when trying to access the memory created using dsm_create().
amulsul <sul_amul@yahoo.co.in>
From: amul sul <sul_amul@yahoo.co.in>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2016-08-12T16:55:06Z
Lists: pgsql-hackers
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? Regards, Amul---------------------------------------------------------------------------------------------------- Sent from a mobile device. Please excuse brevity and tpyos. On Fri, 12 Aug, 2016 at 7:38 pm, Tom Lane<tgl@sss.pgh.pa.us> wrote: amul sul <sul_amul@yahoo.co.in> writes: > When I am calling dsm_create on Linux using the POSIX DSM implementation can succeed, but result in SIGBUS when later try to access the memory. This happens because of my system does not have enough shm space & current allocation in dsm_impl_posix does not allocate disk blocks[1]. I wonder can we use fallocate system call (i.e. Zero-fill the file) to ensure that all the file space has really been allocated, so that we don't later seg fault when accessing the memory mapping. But here we will endup by loop calling ‘write’ squillions of times. Wouldn't that just result in a segfault during dsm_create? I think probably what you are describing here is kernel misbehavior akin to memory overcommit. Maybe it *is* memory overcommit and can be turned off the same way. If not, you have material for a kernel bug fix/enhancement request. regards, tom lane
Commits
-
Fix failure-to-read-man-page in commit 899bd785c.
- e5c058e2eed8 9.4.15 landed
- 06852f21544c 9.5.10 landed
- 12ac252f9014 9.6.6 landed
- d29f30d8c3b2 10.0 landed
- 5ea96efaa010 11.0 landed
-
Avoid SIGBUS on Linux when a DSM memory request overruns tmpfs.
- 3a07a6f3e8d2 9.4.15 landed
- 175061222470 9.6.6 landed
- 05297416f362 9.5.10 landed
- 899bd785c0ed 11.0 landed
- 4621c7f7a432 10.0 landed