Issue 8975 - Calling mdb_env_set_mapsize on a shared DB fails sometimes
Summary: Calling mdb_env_set_mapsize on a shared DB fails sometimes
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-08 16:24 UTC by kriszyp@gmail.com
Modified: 2019-07-24 19:03 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description kriszyp@gmail.com 2019-02-08 16:24:40 UTC
Full_Name: Kristopher William Zyp
Version: LMDB 0.9.23
OS: Windows Server 2012 R2, Windows 10
URL: https://github.com/kriszyp/node-lmdb/commit/6df903907f5516320e9a8afce45bd32ab4e8e1f2.patch
Submission from: (NULL) (71.199.6.148)


Calling mdb_env_set_mapsize to increase the map size, when a DB is also in use
by other processes, when MDB_WRITEMAP is enabled (and the db file has been
opened with PAGE_READWRITE access), on Windows, will occasionally (seems like
about 1/100 attempts fails) produce an error "The requested operation cannot be
performed on a file with a user-mapped section open", or segfaults. The error
occurs in the SetFilePointer (or SetEndOfFile) call in mdb_env_map that is
performed to increase the allocated file size to the map size, prior to
CreateFileMapping.

As it turns out this is pretty easy to solve, because manually expanding the
file size is not necessary when calling CreateFileMapping with PAGE_READWRITE
access, as Windows will automatically expand the file size for us, when opened
with the page write access enabled. Of course, this means all processes must be
consistent in use of MDB_WRITEMAP, but the documentation already makes this
explicit and clear.

I believe this can be fixed by simply adding a check for MDB_WRITEMAP in the if
statement that calls SetFilePointer:

		if (!(flags & MDB_WRITEMAP) && (SetFilePointer(env->me_fd, sizelo, &sizehi, 0)
!= (DWORD)sizelo
			|| !SetEndOfFile(env->me_fd)
			|| SetFilePointer(env->me_fd, 0, NULL, 0) != 0))
			return ErrCode();

The attached URL has the change as a patch/diff as applied to our node package.

I am certainly happy to just keep this change on our own branches. There may be
nuances of this that I might not be aware of, but it seems to be working great
for us and I have tested this with MDB_WRITEMAP enabled and disabled. So I
thought I would offer/suggest this change, as it seems like it is
straightforward change to improve stability. Thank you!
Comment 1 Howard Chu 2019-02-10 10:13:56 UTC
kriszyp@gmail.com wrote:
> Full_Name: Kristopher William Zyp
> Version: LMDB 0.9.23
> OS: Windows Server 2012 R2, Windows 10
> URL: https://github.com/kriszyp/node-lmdb/commit/6df903907f5516320e9a8afce45bd32ab4e8e1f2.patch
> Submission from: (NULL) (71.199.6.148)
> 

Thanks for the report and patch, added to mdb.RE/0.9

> Calling mdb_env_set_mapsize to increase the map size, when a DB is also in use
> by other processes, when MDB_WRITEMAP is enabled (and the db file has been
> opened with PAGE_READWRITE access), on Windows, will occasionally (seems like
> about 1/100 attempts fails) produce an error "The requested operation cannot be
> performed on a file with a user-mapped section open", or segfaults. The error
> occurs in the SetFilePointer (or SetEndOfFile) call in mdb_env_map that is
> performed to increase the allocated file size to the map size, prior to
> CreateFileMapping.
> 
> As it turns out this is pretty easy to solve, because manually expanding the
> file size is not necessary when calling CreateFileMapping with PAGE_READWRITE
> access, as Windows will automatically expand the file size for us, when opened
> with the page write access enabled. Of course, this means all processes must be
> consistent in use of MDB_WRITEMAP, but the documentation already makes this
> explicit and clear.
> 
> I believe this can be fixed by simply adding a check for MDB_WRITEMAP in the if
> statement that calls SetFilePointer:
> 
> 		if (!(flags & MDB_WRITEMAP) && (SetFilePointer(env->me_fd, sizelo, &sizehi, 0)
> != (DWORD)sizelo
> 			|| !SetEndOfFile(env->me_fd)
> 			|| SetFilePointer(env->me_fd, 0, NULL, 0) != 0))
> 			return ErrCode();
> 
> The attached URL has the change as a patch/diff as applied to our node package.
> 
> I am certainly happy to just keep this change on our own branches. There may be
> nuances of this that I might not be aware of, but it seems to be working great
> for us and I have tested this with MDB_WRITEMAP enabled and disabled. So I
> thought I would offer/suggest this change, as it seems like it is
> straightforward change to improve stability. Thank you!
> 
> 


-- 
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 2 kriszyp@gmail.com 2019-02-21 16:45:24 UTC
Thank you, I appreciate it! Do you know how often or when this will get
into the github mirror https://github.com/LMDB/lmdb/commits/mdb.RE/0.9 (or
if I am misunderstanding how the branches are synced)?

On Sun, Feb 10, 2019 at 3:14 AM Howard Chu <hyc@symas.com> wrote:

> kriszyp@gmail.com wrote:
> > Full_Name: Kristopher William Zyp
> > Version: LMDB 0.9.23
> > OS: Windows Server 2012 R2, Windows 10
> > URL:
> https://github.com/kriszyp/node-lmdb/commit/6df903907f5516320e9a8afce45bd32ab4e8e1f2.patch
> > Submission from: (NULL) (71.199.6.148)
> >
>
> Thanks for the report and patch, added to mdb.RE/0.9
>
> > Calling mdb_env_set_mapsize to increase the map size, when a DB is also
> in use
> > by other processes, when MDB_WRITEMAP is enabled (and the db file has
> been
> > opened with PAGE_READWRITE access), on Windows, will occasionally (seems
> like
> > about 1/100 attempts fails) produce an error "The requested operation
> cannot be
> > performed on a file with a user-mapped section open", or segfaults. The
> error
> > occurs in the SetFilePointer (or SetEndOfFile) call in mdb_env_map that
> is
> > performed to increase the allocated file size to the map size, prior to
> > CreateFileMapping.
> >
> > As it turns out this is pretty easy to solve, because manually expanding
> the
> > file size is not necessary when calling CreateFileMapping with
> PAGE_READWRITE
> > access, as Windows will automatically expand the file size for us, when
> opened
> > with the page write access enabled. Of course, this means all processes
> must be
> > consistent in use of MDB_WRITEMAP, but the documentation already makes
> this
> > explicit and clear.
> >
> > I believe this can be fixed by simply adding a check for MDB_WRITEMAP in
> the if
> > statement that calls SetFilePointer:
> >
> >               if (!(flags & MDB_WRITEMAP) && (SetFilePointer(env->me_fd,
> sizelo, &sizehi, 0)
> > != (DWORD)sizelo
> >                       || !SetEndOfFile(env->me_fd)
> >                       || SetFilePointer(env->me_fd, 0, NULL, 0) != 0))
> >                       return ErrCode();
> >
> > The attached URL has the change as a patch/diff as applied to our node
> package.
> >
> > I am certainly happy to just keep this change on our own branches. There
> may be
> > nuances of this that I might not be aware of, but it seems to be working
> great
> > for us and I have tested this with MDB_WRITEMAP enabled and disabled. So
> I
> > thought I would offer/suggest this change, as it seems like it is
> > straightforward change to improve stability. Thank you!
> >
> >
>
>
> --
>   -- Howard Chu
>   CTO, Symas Corp.           http://www.symas.com
>   Director, Highland Sun     http://highlandsun.com/hyc/
>   Chief Architect, OpenLDAP  http://www.openldap.org/project/
>
Comment 3 Quanah Gibson-Mount 2019-02-21 17:12:45 UTC
Hi,

It is literally the first set of commits listed at that URL, so it's 
clearly already there.

Hope that helps!

--Quanah

--On Thursday, February 21, 2019 4:45 PM +0000 kriszyp@gmail.com wrote:

> --0000000000000dacee05826a34a9
> Content-Type: text/plain; charset="UTF-8"
>
> Thank you, I appreciate it! Do you know how often or when this will get
> into the github mirror https://github.com/LMDB/lmdb/commits/mdb.RE/0.9 (or
> if I am misunderstanding how the branches are synced)?
>
> On Sun, Feb 10, 2019 at 3:14 AM Howard Chu <hyc@symas.com> wrote:
>
>> kriszyp@gmail.com wrote:
>> > Full_Name: Kristopher William Zyp
>> > Version: LMDB 0.9.23
>> > OS: Windows Server 2012 R2, Windows 10
>> > URL:
>> https://github.com/kriszyp/node-lmdb/commit/6df903907f5516320e9a8afce45b
>> d32ab4e8e1f2.patch
>> > Submission from: (NULL) (71.199.6.148)
>> >
>>
>> Thanks for the report and patch, added to mdb.RE/0.9
>>
>> > Calling mdb_env_set_mapsize to increase the map size, when a DB is also
>> in use
>> > by other processes, when MDB_WRITEMAP is enabled (and the db file has
>> been
>> > opened with PAGE_READWRITE access), on Windows, will occasionally
>> > (seems
>> like
>> > about 1/100 attempts fails) produce an error "The requested operation
>> cannot be
>> > performed on a file with a user-mapped section open", or segfaults. The
>> error
>> > occurs in the SetFilePointer (or SetEndOfFile) call in mdb_env_map that
>> is
>> > performed to increase the allocated file size to the map size, prior to
>> > CreateFileMapping.
>> >
>> > As it turns out this is pretty easy to solve, because manually
>> > expanding
>> the
>> > file size is not necessary when calling CreateFileMapping with
>> PAGE_READWRITE
>> > access, as Windows will automatically expand the file size for us, when
>> opened
>> > with the page write access enabled. Of course, this means all processes
>> must be
>> > consistent in use of MDB_WRITEMAP, but the documentation already makes
>> this
>> > explicit and clear.
>> >
>> > I believe this can be fixed by simply adding a check for MDB_WRITEMAP
>> > in
>> the if
>> > statement that calls SetFilePointer:
>> >
>> >               if (!(flags & MDB_WRITEMAP) &&
>> >               (SetFilePointer(env->me_fd,
>> sizelo, &sizehi, 0)
>> > != (DWORD)sizelo
>> >                       || !SetEndOfFile(env->me_fd)
>> >                       || SetFilePointer(env->me_fd, 0, NULL, 0) != 0))
>> >                       return ErrCode();
>> >
>> > The attached URL has the change as a patch/diff as applied to our node
>> package.
>> >
>> > I am certainly happy to just keep this change on our own branches.
>> > There
>> may be
>> > nuances of this that I might not be aware of, but it seems to be
>> > working
>> great
>> > for us and I have tested this with MDB_WRITEMAP enabled and disabled.
>> > So
>> I
>> > thought I would offer/suggest this change, as it seems like it is
>> > straightforward change to improve stability. Thank you!
>> >
>> >
>>
>>
>> --
>>   -- Howard Chu
>>   CTO, Symas Corp.           http://www.symas.com
>>   Director, Highland Sun     http://highlandsun.com/hyc/
>>   Chief Architect, OpenLDAP  http://www.openldap.org/project/
>>
>
> --0000000000000dacee05826a34a9
> Content-Type: text/html; charset="UTF-8"
> Content-Transfer-Encoding: quoted-printable
>
> <div dir=3D"ltr"><div dir=3D"ltr">Thank you, I appreciate it! Do you know
> h= ow often or when this will get into the github mirror <a
> href=3D"https://gi=
> thub.com/LMDB/lmdb/commits/mdb.RE/0.9">https://github.com/LMDB/lmdb/commi
> ts= /mdb.RE/0.9</a> (or if I am misunderstanding how the branches are
> synced)?<= /div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr"
> class=3D"gmail_a= ttr">On Sun, Feb 10, 2019 at 3:14 AM Howard Chu &lt;<a
> href=3D"mailto:hyc@s= ymas.com">hyc@symas.com</a>&gt;
> wrote:<br></div><blockquote class=3D"gmail_= quote" style=3D"margin:0px
> 0px 0px 0.8ex;border-left:1px solid rgb(204,204,=
> 204);padding-left:1ex"><a href=3D"mailto:kriszyp@gmail.com"
> target=3D"_blan= k">kriszyp@gmail.com</a> wrote:<br>
> &gt; Full_Name: Kristopher William Zyp<br>
> &gt; Version: LMDB 0.9.23<br>
> &gt; OS: Windows Server 2012 R2, Windows 10<br>
> &gt; URL: <a
> href=3D"https://github.com/kriszyp/node-lmdb/commit/6df903907f=
> 5516320e9a8afce45bd32ab4e8e1f2.patch" rel=3D"noreferrer"
> target=3D"_blank">=
> https://github.com/kriszyp/node-lmdb/commit/6df903907f5516320e9a8afce45bd
> 32= ab4e8e1f2.patch</a><br>
> &gt; Submission from: (NULL) (71.199.6.148)<br>
> &gt; <br>
> <br>
> Thanks for the report and patch, added to mdb.RE/0.9<br>
> <br>
> &gt; Calling mdb_env_set_mapsize to increase the map size, when a DB is
> als= o in use<br>
> &gt; by other processes, when MDB_WRITEMAP is enabled (and the db file
> has = been<br>
> &gt; opened with PAGE_READWRITE access), on Windows, will occasionally
> (see= ms like<br>
> &gt; about 1/100 attempts fails) produce an error &quot;The requested
> opera= tion cannot be<br>
> &gt; performed on a file with a user-mapped section open&quot;, or
> segfault= s. The error<br>
> &gt; occurs in the SetFilePointer (or SetEndOfFile) call in mdb_env_map
> tha= t is<br>
> &gt; performed to increase the allocated file size to the map size, prior
> t= o<br>
> &gt; CreateFileMapping.<br>
> &gt; <br>
> &gt; As it turns out this is pretty easy to solve, because manually
> expandi= ng the<br>
> &gt; file size is not necessary when calling CreateFileMapping with
> PAGE_RE= ADWRITE<br>
> &gt; access, as Windows will automatically expand the file size for us,
> whe= n opened<br>
> &gt; with the page write access enabled. Of course, this means all
> processe= s must be<br>
> &gt; consistent in use of MDB_WRITEMAP, but the documentation already
> makes=  this<br>
> &gt; explicit and clear.<br>
> &gt; <br>
> &gt; I believe this can be fixed by simply adding a check for
> MDB_WRITEMAP = in the if<br>
> &gt; statement that calls SetFilePointer:<br>
> &gt; <br>
> &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!(flags
> &amp= ; MDB_WRITEMAP) &amp;&amp; (SetFilePointer(env-&gt;me_fd, sizelo,
> &amp;size= hi, 0)<br>
> &gt; !=3D (DWORD)sizelo<br>
> &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> = =C2=A0 =C2=A0|| !SetEndOfFile(env-&gt;me_fd)<br>
> &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> = =C2=A0 =C2=A0|| SetFilePointer(env-&gt;me_fd, 0, NULL, 0) !=3D 0))<br>
> &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> = =C2=A0 =C2=A0return ErrCode();<br>
> &gt; <br>
> &gt; The attached URL has the change as a patch/diff as applied to our
> node=  package.<br>
> &gt; <br>
> &gt; I am certainly happy to just keep this change on our own branches.
> The= re may be<br>
> &gt; nuances of this that I might not be aware of, but it seems to be
> worki= ng great<br>
> &gt; for us and I have tested this with MDB_WRITEMAP enabled and
> disabled. = So I<br>
> &gt; thought I would offer/suggest this change, as it seems like it is<br>
> &gt; straightforward change to improve stability. Thank you!<br>
> &gt; <br>
> &gt; <br>
> <br>
> <br>
> -- <br>
> =C2=A0 -- Howard Chu<br>
> =C2=A0 CTO, Symas Corp.=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<a
> href=3D"= http://www.symas.com" rel=3D"noreferrer"
> target=3D"_blank">http://www.symas= .com</a><br>
> =C2=A0 Director, Highland Sun=C2=A0 =C2=A0 =C2=A0<a
> href=3D"http://highland= sun.com/hyc/" rel=3D"noreferrer"
> target=3D"_blank">http://highlandsun.com/h= yc/</a><br>
> =C2=A0 Chief Architect, OpenLDAP=C2=A0 <a
> href=3D"http://www.openldap.org/p= roject/" rel=3D"noreferrer"
> target=3D"_blank">http://www.openldap.org/proje= ct/</a><br>
> </blockquote></div>
>
> --0000000000000dacee05826a34a9--
>
>
>



--

Quanah Gibson-Mount
Product Architect
Symas Corporation
Packaged, certified, and supported LDAP solutions powered by OpenLDAP:
<http://www.symas.com>


Comment 4 kriszyp@gmail.com 2019-02-21 17:15:00 UTC
I see it now! I really did check even earlier this morning and wasn’t there until recently! Anyway, thank you, sorry for the noise.

Thanks,
Kris

From: Quanah Gibson-Mount
Sent: February 21, 2019 10:12 AM
To: kriszyp@gmail.com; openldap-its@OpenLDAP.org
Subject: Re: (ITS#8975) Calling mdb_env_set_mapsize on a shared DB failssometimes

Hi,

It is literally the first set of commits listed at that URL, so it's 
clearly already there.

Hope that helps!

--Quanah

--On Thursday, February 21, 2019 4:45 PM +0000 kriszyp@gmail.com wrote:

> --0000000000000dacee05826a34a9
> Content-Type: text/plain; charset="UTF-8"
>
> Thank you, I appreciate it! Do you know how often or when this will get
> into the github mirror https://github.com/LMDB/lmdb/commits/mdb.RE/0.9 (or
> if I am misunderstanding how the branches are synced)?
>
> On Sun, Feb 10, 2019 at 3:14 AM Howard Chu <hyc@symas.com> wrote:
>
>> kriszyp@gmail.com wrote:
>> > Full_Name: Kristopher William Zyp
>> > Version: LMDB 0.9.23
>> > OS: Windows Server 2012 R2, Windows 10
>> > URL:
>> https://github.com/kriszyp/node-lmdb/commit/6df903907f5516320e9a8afce45b
>> d32ab4e8e1f2.patch
>> > Submission from: (NULL) (71.199.6.148)
>> >
>>
>> Thanks for the report and patch, added to mdb.RE/0.9
>>
>> > Calling mdb_env_set_mapsize to increase the map size, when a DB is also
>> in use
>> > by other processes, when MDB_WRITEMAP is enabled (and the db file has
>> been
>> > opened with PAGE_READWRITE access), on Windows, will occasionally
>> > (seems
>> like
>> > about 1/100 attempts fails) produce an error "The requested operation
>> cannot be
>> > performed on a file with a user-mapped section open", or segfaults. The
>> error
>> > occurs in the SetFilePointer (or SetEndOfFile) call in mdb_env_map that
>> is
>> > performed to increase the allocated file size to the map size, prior to
>> > CreateFileMapping.
>> >
>> > As it turns out this is pretty easy to solve, because manually
>> > expanding
>> the
>> > file size is not necessary when calling CreateFileMapping with
>> PAGE_READWRITE
>> > access, as Windows will automatically expand the file size for us, when
>> opened
>> > with the page write access enabled. Of course, this means all processes
>> must be
>> > consistent in use of MDB_WRITEMAP, but the documentation already makes
>> this
>> > explicit and clear.
>> >
>> > I believe this can be fixed by simply adding a check for MDB_WRITEMAP
>> > in
>> the if
>> > statement that calls SetFilePointer:
>> >
>> >               if (!(flags & MDB_WRITEMAP) &&
>> >               (SetFilePointer(env->me_fd,
>> sizelo, &sizehi, 0)
>> > != (DWORD)sizelo
>> >                       || !SetEndOfFile(env->me_fd)
>> >                       || SetFilePointer(env->me_fd, 0, NULL, 0) != 0))
>> >                       return ErrCode();
>> >
>> > The attached URL has the change as a patch/diff as applied to our node
>> package.
>> >
>> > I am certainly happy to just keep this change on our own branches.
>> > There
>> may be
>> > nuances of this that I might not be aware of, but it seems to be
>> > working
>> great
>> > for us and I have tested this with MDB_WRITEMAP enabled and disabled.
>> > So
>> I
>> > thought I would offer/suggest this change, as it seems like it is
>> > straightforward change to improve stability. Thank you!
>> >
>> >
>>
>>
>> --
>>   -- Howard Chu
>>   CTO, Symas Corp.           http://www.symas.com
>>   Director, Highland Sun     http://highlandsun.com/hyc/
>>   Chief Architect, OpenLDAP  http://www.openldap.org/project/
>>
>
> --0000000000000dacee05826a34a9
> Content-Type: text/html; charset="UTF-8"
> Content-Transfer-Encoding: quoted-printable
>
> <div dir=3D"ltr"><div dir=3D"ltr">Thank you, I appreciate it! Do you know
> h= ow often or when this will get into the github mirror <a
> href=3D"https://gi=
> thub.com/LMDB/lmdb/commits/mdb.RE/0.9">https://github.com/LMDB/lmdb/commi
> ts= /mdb.RE/0.9</a> (or if I am misunderstanding how the branches are
> synced)?<= /div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr"
> class=3D"gmail_a= ttr">On Sun, Feb 10, 2019 at 3:14 AM Howard Chu &lt;<a
> href=3D"mailto:hyc@s= ymas.com">hyc@symas.com</a>&gt;
> wrote:<br></div><blockquote class=3D"gmail_= quote" style=3D"margin:0px
> 0px 0px 0.8ex;border-left:1px solid rgb(204,204,=
> 204);padding-left:1ex"><a href=3D"mailto:kriszyp@gmail.com"
> target=3D"_blan= k">kriszyp@gmail.com</a> wrote:<br>
> &gt; Full_Name: Kristopher William Zyp<br>
> &gt; Version: LMDB 0.9.23<br>
> &gt; OS: Windows Server 2012 R2, Windows 10<br>
> &gt; URL: <a
> href=3D"https://github.com/kriszyp/node-lmdb/commit/6df903907f=
> 5516320e9a8afce45bd32ab4e8e1f2.patch" rel=3D"noreferrer"
> target=3D"_blank">=
> https://github.com/kriszyp/node-lmdb/commit/6df903907f5516320e9a8afce45bd
> 32= ab4e8e1f2.patch</a><br>
> &gt; Submission from: (NULL) (71.199.6.148)<br>
> &gt; <br>
> <br>
> Thanks for the report and patch, added to mdb.RE/0.9<br>
> <br>
> &gt; Calling mdb_env_set_mapsize to increase the map size, when a DB is
> als= o in use<br>
> &gt; by other processes, when MDB_WRITEMAP is enabled (and the db file
> has = been<br>
> &gt; opened with PAGE_READWRITE access), on Windows, will occasionally
> (see= ms like<br>
> &gt; about 1/100 attempts fails) produce an error &quot;The requested
> opera= tion cannot be<br>
> &gt; performed on a file with a user-mapped section open&quot;, or
> segfault= s. The error<br>
> &gt; occurs in the SetFilePointer (or SetEndOfFile) call in mdb_env_map
> tha= t is<br>
> &gt; performed to increase the allocated file size to the map size, prior
> t= o<br>
> &gt; CreateFileMapping.<br>
> &gt; <br>
> &gt; As it turns out this is pretty easy to solve, because manually
> expandi= ng the<br>
> &gt; file size is not necessary when calling CreateFileMapping with
> PAGE_RE= ADWRITE<br>
> &gt; access, as Windows will automatically expand the file size for us,
> whe= n opened<br>
> &gt; with the page write access enabled. Of course, this means all
> processe= s must be<br>
> &gt; consistent in use of MDB_WRITEMAP, but the documentation already
> makes=  this<br>
> &gt; explicit and clear.<br>
> &gt; <br>
> &gt; I believe this can be fixed by simply adding a check for
> MDB_WRITEMAP = in the if<br>
> &gt; statement that calls SetFilePointer:<br>
> &gt; <br>
> &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!(flags
> &amp= ; MDB_WRITEMAP) &amp;&amp; (SetFilePointer(env-&gt;me_fd, sizelo,
> &amp;size= hi, 0)<br>
> &gt; !=3D (DWORD)sizelo<br>
> &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> = =C2=A0 =C2=A0|| !SetEndOfFile(env-&gt;me_fd)<br>
> &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> = =C2=A0 =C2=A0|| SetFilePointer(env-&gt;me_fd, 0, NULL, 0) !=3D 0))<br>
> &gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> = =C2=A0 =C2=A0return ErrCode();<br>
> &gt; <br>
> &gt; The attached URL has the change as a patch/diff as applied to our
> node=  package.<br>
> &gt; <br>
> &gt; I am certainly happy to just keep this change on our own branches.
> The= re may be<br>
> &gt; nuances of this that I might not be aware of, but it seems to be
> worki= ng great<br>
> &gt; for us and I have tested this with MDB_WRITEMAP enabled and
> disabled. = So I<br>
> &gt; thought I would offer/suggest this change, as it seems like it is<br>
> &gt; straightforward change to improve stability. Thank you!<br>
> &gt; <br>
> &gt; <br>
> <br>
> <br>
> -- <br>
> =C2=A0 -- Howard Chu<br>
> =C2=A0 CTO, Symas Corp.=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<a
> href=3D"= http://www.symas.com" rel=3D"noreferrer"
> target=3D"_blank">http://www.symas= .com</a><br>
> =C2=A0 Director, Highland Sun=C2=A0 =C2=A0 =C2=A0<a
> href=3D"http://highland= sun.com/hyc/" rel=3D"noreferrer"
> target=3D"_blank">http://highlandsun.com/h= yc/</a><br>
> =C2=A0 Chief Architect, OpenLDAP=C2=A0 <a
> href=3D"http://www.openldap.org/p= roject/" rel=3D"noreferrer"
> target=3D"_blank">http://www.openldap.org/proje= ct/</a><br>
> </blockquote></div>
>
> --0000000000000dacee05826a34a9--
>
>
>



--

Quanah Gibson-Mount
Product Architect
Symas Corporation
Packaged, certified, and supported LDAP solutions powered by OpenLDAP:
<http://www.symas.com>


Comment 5 Howard Chu 2019-03-10 14:51:12 UTC
changed notes
changed state Open to Release
moved from Incoming to Software Bugs
Comment 6 OpenLDAP project 2019-07-24 19:03:06 UTC
fixed in mdb.RE/0.9
fixed in 0.9.24
Comment 7 Quanah Gibson-Mount 2019-07-24 19:03:06 UTC
changed notes
changed state Release to Closed