[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: (ITS#8975) Calling mdb_env_set_mapsize on a shared DB failssometimes



--_36998F79-0E7E-483F-8FFD-6401D532832A_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="utf-8"

I see it now! I really did check even earlier this morning and wasn=E2=80=
=99t 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 failssom=
etimes

Hi,

It is literally the first set of commits listed at that URL, so it's=20
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=3D"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 (o=
r
> 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 als=
o
>> 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. Th=
e
>> error
>> > occurs in the SetFilePointer (or SetEndOfFile) call in mdb_env_map tha=
t
>> is
>> > performed to increase the allocated file size to the map size, prior t=
o
>> > 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, whe=
n
>> opened
>> > with the page write access enabled. Of course, this means all processe=
s
>> 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)
>> > !=3D (DWORD)sizelo
>> >                       || !SetEndOfFile(env->me_fd)
>> >                       || SetFilePointer(env->me_fd, 0, NULL, 0) !=3D 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=3D"UTF-8"
> Content-Transfer-Encoding: quoted-printable
>
> <div dir=3D3D"ltr"><div dir=3D3D"ltr">Thank you, I appreciate it! Do you =
know
> h=3D ow often or when this will get into the github mirror <a
> href=3D3D"https://gi=3D
> thub.com/LMDB/lmdb/commits/mdb.RE/0.9">https://github.com/LMDB/lmdb/commi
> ts=3D /mdb.RE/0.9</a> (or if I am misunderstanding how the branches are
> synced)?<=3D /div></div><br><div class=3D3D"gmail_quote"><div dir=3D3D"lt=
r"
> class=3D3D"gmail_a=3D ttr">On Sun, Feb 10, 2019 at 3:14 AM Howard Chu &lt=
;<a
> href=3D3D"mailto:hyc@s=3D ymas.com">hyc@symas.com</a>&gt;
> wrote:<br></div><blockquote class=3D3D"gmail_=3D quote" style=3D3D"margin=
:0px
> 0px 0px 0.8ex;border-left:1px solid rgb(204,204,=3D
> 204);padding-left:1ex"><a href=3D3D"mailto:kriszyp@gmail.com";
> target=3D3D"_blan=3D 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=3D3D"https://github.com/kriszyp/node-lmdb/commit/6df903907f=3D
> 5516320e9a8afce45bd32ab4e8e1f2.patch" rel=3D3D"noreferrer"
> target=3D3D"_blank">=3D
> https://github.com/kriszyp/node-lmdb/commit/6df903907f5516320e9a8afce45bd
> 32=3D 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=3D o in use<br>
> &gt; by other processes, when MDB_WRITEMAP is enabled (and the db file
> has =3D been<br>
> &gt; opened with PAGE_READWRITE access), on Windows, will occasionally
> (see=3D ms like<br>
> &gt; about 1/100 attempts fails) produce an error &quot;The requested
> opera=3D tion cannot be<br>
> &gt; performed on a file with a user-mapped section open&quot;, or
> segfault=3D s. The error<br>
> &gt; occurs in the SetFilePointer (or SetEndOfFile) call in mdb_env_map
> tha=3D t is<br>
> &gt; performed to increase the allocated file size to the map size, prior
> t=3D o<br>
> &gt; CreateFileMapping.<br>
> &gt; <br>
> &gt; As it turns out this is pretty easy to solve, because manually
> expandi=3D ng the<br>
> &gt; file size is not necessary when calling CreateFileMapping with
> PAGE_RE=3D ADWRITE<br>
> &gt; access, as Windows will automatically expand the file size for us,
> whe=3D n opened<br>
> &gt; with the page write access enabled. Of course, this means all
> processe=3D s must be<br>
> &gt; consistent in use of MDB_WRITEMAP, but the documentation already
> makes=3D  this<br>
> &gt; explicit and clear.<br>
> &gt; <br>
> &gt; I believe this can be fixed by simply adding a check for
> MDB_WRITEMAP =3D in the if<br>
> &gt; statement that calls SetFilePointer:<br>
> &gt; <br>
> &gt;=3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3D=
C2=3DA0 =3DC2=3DA0if (!(flags
> &amp=3D ; MDB_WRITEMAP) &amp;&amp; (SetFilePointer(env-&gt;me_fd, sizelo,
> &amp;size=3D hi, 0)<br>
> &gt; !=3D3D (DWORD)sizelo<br>
> &gt;=3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3D=
C2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0
> =3D =3DC2=3DA0 =3DC2=3DA0|| !SetEndOfFile(env-&gt;me_fd)<br>
> &gt;=3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3D=
C2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0
> =3D =3DC2=3DA0 =3DC2=3DA0|| SetFilePointer(env-&gt;me_fd, 0, NULL, 0) !=
=3D3D 0))<br>
> &gt;=3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3D=
C2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0
> =3D =3DC2=3DA0 =3DC2=3DA0return ErrCode();<br>
> &gt; <br>
> &gt; The attached URL has the change as a patch/diff as applied to our
> node=3D  package.<br>
> &gt; <br>
> &gt; I am certainly happy to just keep this change on our own branches.
> The=3D re may be<br>
> &gt; nuances of this that I might not be aware of, but it seems to be
> worki=3D ng great<br>
> &gt; for us and I have tested this with MDB_WRITEMAP enabled and
> disabled. =3D 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>
> =3DC2=3DA0 -- Howard Chu<br>
> =3DC2=3DA0 CTO, Symas Corp.=3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =
=3DC2=3DA0 =3DC2=3DA0<a
> href=3D3D"=3D http://www.symas.com"; rel=3D3D"noreferrer"
> target=3D3D"_blank">http://www.symas=3D .com</a><br>
> =3DC2=3DA0 Director, Highland Sun=3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0<a
> href=3D3D"http://highland=3D sun.com/hyc/" rel=3D3D"noreferrer"
> target=3D3D"_blank">http://highlandsun.com/h=3D yc/</a><br>
> =3DC2=3DA0 Chief Architect, OpenLDAP=3DC2=3DA0 <a
> href=3D3D"http://www.openldap.org/p=3D roject/" rel=3D3D"noreferrer"
> target=3D3D"_blank">http://www.openldap.org/proje=3D 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>



--_36998F79-0E7E-483F-8FFD-6401D532832A_
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="utf-8"

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:w=3D"urn:sc=
hemas-microsoft-com:office:word" xmlns:m=3D"http://schemas.microsoft.com/of=
fice/2004/12/omml" xmlns=3D"http://www.w3.org/TR/REC-html40";><head><meta ht=
tp-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8"><meta name=
=3DGenerator content=3D"Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style></head><body lang=3DEN-CA link=3Dblue vlink=3D"#954F72"><div cla=
ss=3DWordSection1><p class=3DMsoNormal>I see it now! I really did check eve=
n earlier this morning and wasn=E2=80=99t there until recently! Anyway, tha=
nk you, sorry for the noise.</p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><=
p class=3DMsoNormal>Thanks,<br>Kris</p><p class=3DMsoNormal><o:p>&nbsp;</o:=
p></p><div style=3D'mso-element:para-border-div;border:none;border-top:soli=
d #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=3DMsoNormal style=3D'bo=
rder:none;padding:0cm'><b>From: </b><a href=3D"mailto:quanah@symas.com";>Qua=
nah Gibson-Mount</a><br><b>Sent: </b>February 21, 2019 10:12 AM<br><b>To: <=
/b><a href=3D"mailto:kriszyp@gmail.com";>kriszyp@gmail.com</a>; <a href=3D"m=
ailto:openldap-its@OpenLDAP.org">openldap-its@OpenLDAP.org</a><br><b>Subjec=
t: </b>Re: (ITS#8975) Calling mdb_env_set_mapsize on a shared DB failssomet=
imes</p></div><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNorma=
l>Hi,</p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>It =
is literally the first set of commits listed at that URL, so it's </p><p cl=
ass=3DMsoNormal>clearly already there.</p><p class=3DMsoNormal><o:p>&nbsp;<=
/o:p></p><p class=3DMsoNormal>Hope that helps!</p><p class=3DMsoNormal><o:p=
>&nbsp;</o:p></p><p class=3DMsoNormal>--Quanah</p><p class=3DMsoNormal><o:p=
>&nbsp;</o:p></p><p class=3DMsoNormal>--On Thursday, February 21, 2019 4:45=
 PM +0000 kriszyp@gmail.com wrote:</p><p class=3DMsoNormal><o:p>&nbsp;</o:p=
></p><p class=3DMsoNormal>&gt; --0000000000000dacee05826a34a9</p><p class=
=3DMsoNormal>&gt; Content-Type: text/plain; charset=3D&quot;UTF-8&quot;</p>=
<p class=3DMsoNormal>&gt;<o:p>&nbsp;</o:p></p><p class=3DMsoNormal>&gt; Tha=
nk you, I appreciate it! Do you know how often or when this will get</p><p =
class=3DMsoNormal>&gt; into the github mirror https://github.com/LMDB/lmdb/=
commits/mdb.RE/0.9 (or</p><p class=3DMsoNormal>&gt; if I am misunderstandin=
g how the branches are synced)?</p><p class=3DMsoNormal>&gt;<o:p>&nbsp;</o:=
p></p><p class=3DMsoNormal>&gt; On Sun, Feb 10, 2019 at 3:14 AM Howard Chu =
&lt;hyc@symas.com&gt; wrote:</p><p class=3DMsoNormal>&gt;<o:p>&nbsp;</o:p><=
/p><p class=3DMsoNormal>&gt;&gt; kriszyp@gmail.com wrote:</p><p class=3DMso=
Normal>&gt;&gt; &gt; Full_Name: Kristopher William Zyp</p><p class=3DMsoNor=
mal>&gt;&gt; &gt; Version: LMDB 0.9.23</p><p class=3DMsoNormal>&gt;&gt; &gt=
; OS: Windows Server 2012 R2, Windows 10</p><p class=3DMsoNormal>&gt;&gt; &=
gt; URL:</p><p class=3DMsoNormal>&gt;&gt; https://github.com/kriszyp/node-l=
mdb/commit/6df903907f5516320e9a8afce45b</p><p class=3DMsoNormal>&gt;&gt; d3=
2ab4e8e1f2.patch</p><p class=3DMsoNormal>&gt;&gt; &gt; Submission from: (NU=
LL) (71.199.6.148)</p><p class=3DMsoNormal>&gt;&gt; &gt;</p><p class=3DMsoN=
ormal>&gt;&gt;<o:p>&nbsp;</o:p></p><p class=3DMsoNormal>&gt;&gt; Thanks for=
 the report and patch, added to mdb.RE/0.9</p><p class=3DMsoNormal>&gt;&gt;=
<o:p>&nbsp;</o:p></p><p class=3DMsoNormal>&gt;&gt; &gt; Calling mdb_env_set=
_mapsize to increase the map size, when a DB is also</p><p class=3DMsoNorma=
l>&gt;&gt; in use</p><p class=3DMsoNormal>&gt;&gt; &gt; by other processes,=
 when MDB_WRITEMAP is enabled (and the db file has</p><p class=3DMsoNormal>=
&gt;&gt; been</p><p class=3DMsoNormal>&gt;&gt; &gt; opened with PAGE_READWR=
ITE access), on Windows, will occasionally</p><p class=3DMsoNormal>&gt;&gt;=
 &gt; (seems</p><p class=3DMsoNormal>&gt;&gt; like</p><p class=3DMsoNormal>=
&gt;&gt; &gt; about 1/100 attempts fails) produce an error &quot;The reques=
ted operation</p><p class=3DMsoNormal>&gt;&gt; cannot be</p><p class=3DMsoN=
ormal>&gt;&gt; &gt; performed on a file with a user-mapped section open&quo=
t;, or segfaults. The</p><p class=3DMsoNormal>&gt;&gt; error</p><p class=3D=
MsoNormal>&gt;&gt; &gt; occurs in the SetFilePointer (or SetEndOfFile) call=
 in mdb_env_map that</p><p class=3DMsoNormal>&gt;&gt; is</p><p class=3DMsoN=
ormal>&gt;&gt; &gt; performed to increase the allocated file size to the ma=
p size, prior to</p><p class=3DMsoNormal>&gt;&gt; &gt; CreateFileMapping.</=
p><p class=3DMsoNormal>&gt;&gt; &gt;</p><p class=3DMsoNormal>&gt;&gt; &gt; =
As it turns out this is pretty easy to solve, because manually</p><p class=
=3DMsoNormal>&gt;&gt; &gt; expanding</p><p class=3DMsoNormal>&gt;&gt; the</=
p><p class=3DMsoNormal>&gt;&gt; &gt; file size is not necessary when callin=
g CreateFileMapping with</p><p class=3DMsoNormal>&gt;&gt; PAGE_READWRITE</p=
><p class=3DMsoNormal>&gt;&gt; &gt; access, as Windows will automatically e=
xpand the file size for us, when</p><p class=3DMsoNormal>&gt;&gt; opened</p=
><p class=3DMsoNormal>&gt;&gt; &gt; with the page write access enabled. Of =
course, this means all processes</p><p class=3DMsoNormal>&gt;&gt; must be</=
p><p class=3DMsoNormal>&gt;&gt; &gt; consistent in use of MDB_WRITEMAP, but=
 the documentation already makes</p><p class=3DMsoNormal>&gt;&gt; this</p><=
p class=3DMsoNormal>&gt;&gt; &gt; explicit and clear.</p><p class=3DMsoNorm=
al>&gt;&gt; &gt;</p><p class=3DMsoNormal>&gt;&gt; &gt; I believe this can b=
e fixed by simply adding a check for MDB_WRITEMAP</p><p class=3DMsoNormal>&=
gt;&gt; &gt; in</p><p class=3DMsoNormal>&gt;&gt; the if</p><p class=3DMsoNo=
rmal>&gt;&gt; &gt; statement that calls SetFilePointer:</p><p class=3DMsoNo=
rmal>&gt;&gt; &gt;</p><p class=3DMsoNormal>&gt;&gt; &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=C2=A0=C2=A0 if (!(fl=
ags &amp; MDB_WRITEMAP) &amp;&amp;</p><p class=3DMsoNormal>&gt;&gt; &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=C2=A0=
=C2=A0 (SetFilePointer(env-&gt;me_fd,</p><p class=3DMsoNormal>&gt;&gt; size=
lo, &amp;sizehi, 0)</p><p class=3DMsoNormal>&gt;&gt; &gt; !=3D (DWORD)sizel=
o</p><p class=3DMsoNormal>&gt;&gt; &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=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)</p><p class=3DMsoNorm=
al>&gt;&gt; &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=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))</p><p class=3DMsoNor=
mal>&gt;&gt; &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=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
 return ErrCode();</p><p class=3DMsoNormal>&gt;&gt; &gt;</p><p class=3DMsoN=
ormal>&gt;&gt; &gt; The attached URL has the change as a patch/diff as appl=
ied to our node</p><p class=3DMsoNormal>&gt;&gt; package.</p><p class=3DMso=
Normal>&gt;&gt; &gt;</p><p class=3DMsoNormal>&gt;&gt; &gt; I am certainly h=
appy to just keep this change on our own branches.</p><p class=3DMsoNormal>=
&gt;&gt; &gt; There</p><p class=3DMsoNormal>&gt;&gt; may be</p><p class=3DM=
soNormal>&gt;&gt; &gt; nuances of this that I might not be aware of, but it=
 seems to be</p><p class=3DMsoNormal>&gt;&gt; &gt; working</p><p class=3DMs=
oNormal>&gt;&gt; great</p><p class=3DMsoNormal>&gt;&gt; &gt; for us and I h=
ave tested this with MDB_WRITEMAP enabled and disabled.</p><p class=3DMsoNo=
rmal>&gt;&gt; &gt; So</p><p class=3DMsoNormal>&gt;&gt; I</p><p class=3DMsoN=
ormal>&gt;&gt; &gt; thought I would offer/suggest this change, as it seems =
like it is</p><p class=3DMsoNormal>&gt;&gt; &gt; straightforward change to =
improve stability. Thank you!</p><p class=3DMsoNormal>&gt;&gt; &gt;</p><p c=
lass=3DMsoNormal>&gt;&gt; &gt;</p><p class=3DMsoNormal>&gt;&gt;<o:p>&nbsp;<=
/o:p></p><p class=3DMsoNormal>&gt;&gt;<o:p>&nbsp;</o:p></p><p class=3DMsoNo=
rmal>&gt;&gt; --</p><p class=3DMsoNormal>&gt;&gt;=C2=A0=C2=A0 -- Howard Chu=
</p><p class=3DMsoNormal>&gt;&gt;=C2=A0=C2=A0 CTO, Symas Corp.=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 http://www.symas.com</p><p=
 class=3DMsoNormal>&gt;&gt;=C2=A0=C2=A0 Director, Highland Sun=C2=A0=C2=A0=
=C2=A0=C2=A0 http://highlandsun.com/hyc/</p><p class=3DMsoNormal>&gt;&gt;=
=C2=A0=C2=A0 Chief Architect, OpenLDAP=C2=A0 http://www.openldap.org/projec=
t/</p><p class=3DMsoNormal>&gt;&gt;<o:p>&nbsp;</o:p></p><p class=3DMsoNorma=
l>&gt;<o:p>&nbsp;</o:p></p><p class=3DMsoNormal>&gt; --0000000000000dacee05=
826a34a9</p><p class=3DMsoNormal>&gt; Content-Type: text/html; charset=3D&q=
uot;UTF-8&quot;</p><p class=3DMsoNormal>&gt; Content-Transfer-Encoding: quo=
ted-printable</p><p class=3DMsoNormal>&gt;<o:p>&nbsp;</o:p></p><p class=3DM=
soNormal>&gt; &lt;div dir=3D3D&quot;ltr&quot;&gt;&lt;div dir=3D3D&quot;ltr&=
quot;&gt;Thank you, I appreciate it! Do you know</p><p class=3DMsoNormal>&g=
t; h=3D ow often or when this will get into the github mirror &lt;a</p><p c=
lass=3DMsoNormal>&gt; href=3D3D&quot;https://gi=3D</p><p class=3DMsoNormal>=
&gt; thub.com/LMDB/lmdb/commits/mdb.RE/0.9&quot;&gt;https://github.com/LMDB=
/lmdb/commi</p><p class=3DMsoNormal>&gt; ts=3D /mdb.RE/0.9&lt;/a&gt; (or if=
 I am misunderstanding how the branches are</p><p class=3DMsoNormal>&gt; sy=
nced)?&lt;=3D /div&gt;&lt;/div&gt;&lt;br&gt;&lt;div class=3D3D&quot;gmail_q=
uote&quot;&gt;&lt;div dir=3D3D&quot;ltr&quot;</p><p class=3DMsoNormal>&gt; =
class=3D3D&quot;gmail_a=3D ttr&quot;&gt;On Sun, Feb 10, 2019 at 3:14 AM How=
ard Chu &amp;lt;&lt;a</p><p class=3DMsoNormal>&gt; href=3D3D&quot;mailto:hy=
c@s=3D ymas.com&quot;&gt;hyc@symas.com&lt;/a&gt;&amp;gt;</p><p class=3DMsoN=
ormal>&gt; wrote:&lt;br&gt;&lt;/div&gt;&lt;blockquote class=3D3D&quot;gmail=
_=3D quote&quot; style=3D3D&quot;margin:0px</p><p class=3DMsoNormal>&gt; 0p=
x 0px 0.8ex;border-left:1px solid rgb(204,204,=3D</p><p class=3DMsoNormal>&=
gt; 204);padding-left:1ex&quot;&gt;&lt;a href=3D3D&quot;mailto:kriszyp@gmai=
l.com&quot;</p><p class=3DMsoNormal>&gt; target=3D3D&quot;_blan=3D k&quot;&=
gt;kriszyp@gmail.com&lt;/a&gt; wrote:&lt;br&gt;</p><p class=3DMsoNormal>&gt=
; &amp;gt; Full_Name: Kristopher William Zyp&lt;br&gt;</p><p class=3DMsoNor=
mal>&gt; &amp;gt; Version: LMDB 0.9.23&lt;br&gt;</p><p class=3DMsoNormal>&g=
t; &amp;gt; OS: Windows Server 2012 R2, Windows 10&lt;br&gt;</p><p class=3D=
MsoNormal>&gt; &amp;gt; URL: &lt;a</p><p class=3DMsoNormal>&gt; href=3D3D&q=
uot;https://github.com/kriszyp/node-lmdb/commit/6df903907f=3D</p><p class=
=3DMsoNormal>&gt; 5516320e9a8afce45bd32ab4e8e1f2.patch&quot; rel=3D3D&quot;=
noreferrer&quot;</p><p class=3DMsoNormal>&gt; target=3D3D&quot;_blank&quot;=
&gt;=3D</p><p class=3DMsoNormal>&gt; https://github.com/kriszyp/node-lmdb/c=
ommit/6df903907f5516320e9a8afce45bd</p><p class=3DMsoNormal>&gt; 32=3D ab4e=
8e1f2.patch&lt;/a&gt;&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; Submi=
ssion from: (NULL) (71.199.6.148)&lt;br&gt;</p><p class=3DMsoNormal>&gt; &a=
mp;gt; &lt;br&gt;</p><p class=3DMsoNormal>&gt; &lt;br&gt;</p><p class=3DMso=
Normal>&gt; Thanks for the report and patch, added to mdb.RE/0.9&lt;br&gt;<=
/p><p class=3DMsoNormal>&gt; &lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;g=
t; Calling mdb_env_set_mapsize to increase the map size, when a DB is</p><p=
 class=3DMsoNormal>&gt; als=3D o in use&lt;br&gt;</p><p class=3DMsoNormal>&=
gt; &amp;gt; by other processes, when MDB_WRITEMAP is enabled (and the db f=
ile</p><p class=3DMsoNormal>&gt; has =3D been&lt;br&gt;</p><p class=3DMsoNo=
rmal>&gt; &amp;gt; opened with PAGE_READWRITE access), on Windows, will occ=
asionally</p><p class=3DMsoNormal>&gt; (see=3D ms like&lt;br&gt;</p><p clas=
s=3DMsoNormal>&gt; &amp;gt; about 1/100 attempts fails) produce an error &a=
mp;quot;The requested</p><p class=3DMsoNormal>&gt; opera=3D tion cannot be&=
lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; performed on a file with a =
user-mapped section open&amp;quot;, or</p><p class=3DMsoNormal>&gt; segfaul=
t=3D s. The error&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; occurs in=
 the SetFilePointer (or SetEndOfFile) call in mdb_env_map</p><p class=3DMso=
Normal>&gt; tha=3D t is&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; per=
formed to increase the allocated file size to the map size, prior</p><p cla=
ss=3DMsoNormal>&gt; t=3D o&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; =
CreateFileMapping.&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; &lt;br&g=
t;</p><p class=3DMsoNormal>&gt; &amp;gt; As it turns out this is pretty eas=
y to solve, because manually</p><p class=3DMsoNormal>&gt; expandi=3D ng the=
&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; file size is not necessary=
 when calling CreateFileMapping with</p><p class=3DMsoNormal>&gt; PAGE_RE=
=3D ADWRITE&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; access, as Wind=
ows will automatically expand the file size for us,</p><p class=3DMsoNormal=
>&gt; whe=3D n opened&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; with =
the page write access enabled. Of course, this means all</p><p class=3DMsoN=
ormal>&gt; processe=3D s must be&lt;br&gt;</p><p class=3DMsoNormal>&gt; &am=
p;gt; consistent in use of MDB_WRITEMAP, but the documentation already</p><=
p class=3DMsoNormal>&gt; makes=3D=C2=A0 this&lt;br&gt;</p><p class=3DMsoNor=
mal>&gt; &amp;gt; explicit and clear.&lt;br&gt;</p><p class=3DMsoNormal>&gt=
; &amp;gt; &lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; I believe this =
can be fixed by simply adding a check for</p><p class=3DMsoNormal>&gt; MDB_=
WRITEMAP =3D in the if&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; stat=
ement that calls SetFilePointer:&lt;br&gt;</p><p class=3DMsoNormal>&gt; &am=
p;gt; &lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt;=3DC2=3DA0 =3DC2=3DA0=
 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0if (!(fla=
gs</p><p class=3DMsoNormal>&gt; &amp;amp=3D ; MDB_WRITEMAP) &amp;amp;&amp;a=
mp; (SetFilePointer(env-&amp;gt;me_fd, sizelo,</p><p class=3DMsoNormal>&gt;=
 &amp;amp;size=3D hi, 0)&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; !=
=3D3D (DWORD)sizelo&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt;=3DC2=3D=
A0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=
=3DA0 =3DC2=3DA0 =3DC2=3DA0</p><p class=3DMsoNormal>&gt; =3D =3DC2=3DA0 =3D=
C2=3DA0|| !SetEndOfFile(env-&amp;gt;me_fd)&lt;br&gt;</p><p class=3DMsoNorma=
l>&gt; &amp;gt;=3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=
=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0</p><p class=3DMsoNormal>&=
gt; =3D =3DC2=3DA0 =3DC2=3DA0|| SetFilePointer(env-&amp;gt;me_fd, 0, NULL, =
0) !=3D3D 0))&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt;=3DC2=3DA0 =3D=
C2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =
=3DC2=3DA0 =3DC2=3DA0</p><p class=3DMsoNormal>&gt; =3D =3DC2=3DA0 =3DC2=3DA=
0return ErrCode();&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; &lt;br&g=
t;</p><p class=3DMsoNormal>&gt; &amp;gt; The attached URL has the change as=
 a patch/diff as applied to our</p><p class=3DMsoNormal>&gt; node=3D=C2=A0 =
package.&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; &lt;br&gt;</p><p c=
lass=3DMsoNormal>&gt; &amp;gt; I am certainly happy to just keep this chang=
e on our own branches.</p><p class=3DMsoNormal>&gt; The=3D re may be&lt;br&=
gt;</p><p class=3DMsoNormal>&gt; &amp;gt; nuances of this that I might not =
be aware of, but it seems to be</p><p class=3DMsoNormal>&gt; worki=3D ng gr=
eat&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; for us and I have teste=
d this with MDB_WRITEMAP enabled and</p><p class=3DMsoNormal>&gt; disabled.=
 =3D So I&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; thought I would o=
ffer/suggest this change, as it seems like it is&lt;br&gt;</p><p class=3DMs=
oNormal>&gt; &amp;gt; straightforward change to improve stability. Thank yo=
u!&lt;br&gt;</p><p class=3DMsoNormal>&gt; &amp;gt; &lt;br&gt;</p><p class=
=3DMsoNormal>&gt; &amp;gt; &lt;br&gt;</p><p class=3DMsoNormal>&gt; &lt;br&g=
t;</p><p class=3DMsoNormal>&gt; &lt;br&gt;</p><p class=3DMsoNormal>&gt; -- =
&lt;br&gt;</p><p class=3DMsoNormal>&gt; =3DC2=3DA0 -- Howard Chu&lt;br&gt;<=
/p><p class=3DMsoNormal>&gt; =3DC2=3DA0 CTO, Symas Corp.=3DC2=3DA0 =3DC2=3D=
A0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0&lt;a</p><p class=3DMsoNormal=
>&gt; href=3D3D&quot;=3D http://www.symas.com&quot; rel=3D3D&quot;noreferre=
r&quot;</p><p class=3DMsoNormal>&gt; target=3D3D&quot;_blank&quot;&gt;http:=
//www.symas=3D .com&lt;/a&gt;&lt;br&gt;</p><p class=3DMsoNormal>&gt; =3DC2=
=3DA0 Director, Highland Sun=3DC2=3DA0 =3DC2=3DA0 =3DC2=3DA0&lt;a</p><p cla=
ss=3DMsoNormal>&gt; href=3D3D&quot;http://highland=3D sun.com/hyc/&quot; re=
l=3D3D&quot;noreferrer&quot;</p><p class=3DMsoNormal>&gt; target=3D3D&quot;=
_blank&quot;&gt;http://highlandsun.com/h=3D yc/&lt;/a&gt;&lt;br&gt;</p><p c=
lass=3DMsoNormal>&gt; =3DC2=3DA0 Chief Architect, OpenLDAP=3DC2=3DA0 &lt;a<=
/p><p class=3DMsoNormal>&gt; href=3D3D&quot;http://www.openldap.org/p=3D ro=
ject/&quot; rel=3D3D&quot;noreferrer&quot;</p><p class=3DMsoNormal>&gt; tar=
get=3D3D&quot;_blank&quot;&gt;http://www.openldap.org/proje=3D ct/&lt;/a&gt=
;&lt;br&gt;</p><p class=3DMsoNormal>&gt; &lt;/blockquote&gt;&lt;/div&gt;</p=
><p class=3DMsoNormal>&gt;<o:p>&nbsp;</o:p></p><p class=3DMsoNormal>&gt; --=
0000000000000dacee05826a34a9--</p><p class=3DMsoNormal>&gt;<o:p>&nbsp;</o:p=
></p><p class=3DMsoNormal>&gt;<o:p>&nbsp;</o:p></p><p class=3DMsoNormal>&gt=
;<o:p>&nbsp;</o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3D=
MsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p=
 class=3DMsoNormal>--</p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=
=3DMsoNormal>Quanah Gibson-Mount</p><p class=3DMsoNormal>Product Architect<=
/p><p class=3DMsoNormal>Symas Corporation</p><p class=3DMsoNormal>Packaged,=
 certified, and supported LDAP solutions powered by OpenLDAP:</p><p class=
=3DMsoNormal>&lt;http://www.symas.com&gt;</p><p class=3DMsoNormal><o:p>&nbs=
p;</o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p></div></body></html>=

--_36998F79-0E7E-483F-8FFD-6401D532832A_--