[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: (ITS#8350) lmdb SIGBUS error on full partition and possible double free issue
- To: openldap-its@OpenLDAP.org
- Subject: Re: (ITS#8350) lmdb SIGBUS error on full partition and possible double free issue
- From: hyc@symas.com
- Date: Fri, 22 Jan 2016 20:59:40 +0000
- Auto-submitted: auto-generated (OpenLDAP-ITS)
jeremiah.morrill@econnect.tv wrote:
> Full_Name: Jeremiah Morrill
> Version: 0.9
> OS: Linux (Ubuntu14)
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (70.173.183.164)
>
>
> Two possible issues. Semi-related.
>
> The first:
> On a full storage partition, when creating a new database, I get a SIGBUS. I
> believe it is caused by the locks successfully mmap()ing, but not really having
> the storage to back it. I hacked in a "posix_fallocate" to make sure the
> storage space is there and it appeared to fix it. I have no idea what the
> unintended consequences of this change may be.
It might indeed be a good idea to use posix_fallocate, but then we're stuck
trying to figure out which platforms actually support it. In the meantime, if
we know it's available, then it should simply replace the ftruncate() call
which we were already using to set the lockfile size.
For portability reasons I'd be inclined not to use fallocate at all, and just
perform a series of dummy writes() to grow the file to the proper size.
Ultimately I think it's not a big deal; if your program crashes on startup
because there's no disk space, you haven't lost anything and you know that
there's a system problem you need to fix.
> Here is the diff:
>
> void
> @@ -4863,6 +4868,14 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode,
> int *excl)
> void *m = mmap(NULL, rsize, PROT_READ|PROT_WRITE, MAP_SHARED,
> env->me_lfd, 0);
> if (m == MAP_FAILED) goto fail_errno;
> +
> + rc = posix_fallocate(env->me_lfd, 0, rsize);
> +
> + if (rc) {
> + munmap(m, rsize);
> + goto fail;
> + }
> +
> env->me_txns = m;
> #endif
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/