Esent issue on WinXP

87 views
Skip to first unread message

Tobi

unread,
Mar 15, 2012, 1:29:25 PM3/15/12
to ravendb
The first time I've upgraded a customer to the latest stable release of
RavenDB and it crashes :-(

Here's the log:

http://pastie.org/3602347

This only happens on WinXP/32bit. The same operations on the same data
work fine on Win7/64bit. Maybe it is related to the Esent version?

Tobias

Tobi

unread,
Mar 15, 2012, 1:31:59 PM3/15/12
to rav...@googlegroups.com
Am 15.03.2012 18:29, schrieb Tobi:

> http://pastie.org/3602347
>
> This only happens on WinXP/32bit. The same operations on the same data
> work fine on Win7/64bit. Maybe it is related to the Esent version?

PS: This is what the application is doing at this point:

var docs = DocumentDatabase.GetDocumentsWithIdStartingWith("Sales",
skip, 1024);

Tobias


Tobi

unread,
Mar 15, 2012, 2:18:07 PM3/15/12
to rav...@googlegroups.com
PPS: And a tiny program to reproduce the crash:

http://pastie.org/3602810

Works on Win7, but crashes on WinXP.

Tobias

Oren Eini (Ayende Rahien)

unread,
Mar 15, 2012, 3:17:51 PM3/15/12
to rav...@googlegroups.com
Okay, that is interesting.
Can you check what the value of SystemParameters.BookmarkMost is?
I don't have an XP machine handy, would it be possible to do a skype session to resolve this?

Tobi

unread,
Mar 15, 2012, 3:32:09 PM3/15/12
to rav...@googlegroups.com
On 15.03.2012 20:17, Oren Eini (Ayende Rahien) wrote:

> Can you check what the value of SystemParameters.BookmarkMost is?

It's 256.

At this line:

https://github.com/ayende/ravendb/blob/master/Raven.Storage.Esent/StorageActions/OptimizedIndexReader.cs#L72

I see, that bookmark.Length is 0. Didn't had a chance yet to do any
further debugging.

> I don't have an XP machine handy, would it be possible to do a skype
> session to resolve this?

Tomorrow, when I'm back at work. I'm already at home and only have remote
access to my development and the XP machine.

Tobias

Oren Eini (Ayende Rahien)

unread,
Mar 15, 2012, 4:20:29 PM3/15/12
to rav...@googlegroups.com
I can't see how this can happen.
JetGetSecondaryIndexBookmark is there to set things up, and I can't see it returning zero there.
I check , and it is supported on win XP

Tobi

unread,
Mar 15, 2012, 5:08:47 PM3/15/12
to rav...@googlegroups.com
On 15.03.2012 21:20, Oren Eini (Ayende Rahien) wrote:

> I can't see how this can happen.
> JetGetSecondaryIndexBookmark is there to set things up, and I can't see it
> returning zero there.
> I check , and it is supported on win XP

"actualBookmarkSize" (=primary key bookmark buffer size) returned by
JetGetSecondaryIndexBookmark is 0 while "ignored" (=secondary key buffer
size) isn't.

...but I can't explain this either.

Tobias

Oren Eini (Ayende Rahien)

unread,
Mar 16, 2012, 2:23:05 AM3/16/12
to rav...@googlegroups.com
I guess it is possible that on XP, if the first buffer isn't big enough, it won't update the second buffer?

Tobi

unread,
Mar 16, 2012, 3:23:31 AM3/16/12
to rav...@googlegroups.com
On 16.03.2012 07:23, Oren Eini (Ayende Rahien) wrote:

> I guess it is possible that on XP, if the first buffer isn't big enough,
> it won't update the second buffer?

But why should the first buffer be too small?

On Win7 the buffer sizes are 1001 and on WinXP they are 256.

On Win7 AND WinXP I see the actual size of the secondary key never beeing
larger than 26. But the size of the primary key always is returned with 0
on WinXP (and 5 on Win7).

Tobias

Oren Eini (Ayende Rahien)

unread,
Mar 16, 2012, 3:36:44 AM3/16/12
to rav...@googlegroups.com
What is we would pass a null to the first buffer?

Tobi

unread,
Mar 16, 2012, 3:48:21 AM3/16/12
to rav...@googlegroups.com
On 16.03.2012 08:36, Oren Eini (Ayende Rahien) wrote:

> What is we would pass a null to the first buffer?

Passing null, 0 for the secondary key buffer causes a "Buffer too small"
exception as expected.

I'll do some debugging at the Managed Esent as soon as I'm back in the
office to see what the actual return value of JetGetSecondaryIndexBookmark is.

You have more insight into the Esent-interface. How should a tiny test
program look like that just opens the Esent DB and runs
JetGetSecondaryIndexBookmark?

Tobias

Oren Eini (Ayende Rahien)

unread,
Mar 16, 2012, 4:09:36 AM3/16/12
to rav...@googlegroups.com
I attached a minimal program that uses this.
Program.cs

Tobi

unread,
Mar 16, 2012, 5:36:42 AM3/16/12
to rav...@googlegroups.com
On 16.03.2012 09:09, Oren Eini (Ayende Rahien) wrote:

> I attached a minimal program that uses this.

...small bug in format string, but it works just fine:

Pri 4 Sec 16

Tobias

Tobi

unread,
Mar 16, 2012, 6:28:38 AM3/16/12
to rav...@googlegroups.com
On 16.03.2012 10:36, Tobi wrote:

I've enabled a trace log for Managed Esent:

Win7: http://pastie.org/3607189
WinXP: http://pastie.org/3607194

Tobias

Tobi

unread,
Mar 16, 2012, 6:30:03 AM3/16/12
to rav...@googlegroups.com

PS: This was for opening an existing DB and doing a single
GetDocumentsWithIdStartingWith() call.

Tobias

Oren Eini (Ayende Rahien)

unread,
Mar 16, 2012, 6:37:00 AM3/16/12
to rav...@googlegroups.com
What happen if you continue to do iterations on the data? Api.TryMoveNext() ?

Tobi

unread,
Mar 16, 2012, 6:46:09 AM3/16/12
to rav...@googlegroups.com
On 16.03.2012 11:37, Oren Eini (Ayende Rahien) wrote:

> What happen if you continue to do iterations on the data? Api.TryMoveNext() ?

Same return values:

Pri 4 Sec 16
Pri 4 Sec 16
Pri 4 Sec 16
Pri 4 Sec 16
...

Tobias

Tobi

unread,
Mar 16, 2012, 7:58:54 AM3/16/12
to rav...@googlegroups.com
I'm running out if ideas.

I tried to reproduce every single Esent-API-call from
GetDocumentsWithIdStartingWith(), but I fail to reproduce this problem in
isolation.

But on WinXP GetDocumentsWithIdStartingWith() fails consistently.

Tobias

Oren Eini (Ayende Rahien)

unread,
Mar 16, 2012, 8:25:45 AM3/16/12
to rav...@googlegroups.com
Okay, I'll take a look on Sunday.

Tobi

unread,
Mar 16, 2012, 8:57:25 AM3/16/12
to rav...@googlegroups.com
On 16.03.2012 13:25, Oren Eini (Ayende Rahien) wrote:

> Okay, I'll take a look on Sunday.

Ok.

To add some extra weirdness to the problem:

Map/reduce, which uses the OptimizedIndexReader as well, works fine on
WinXP and the actualBookmarkSize returned by JetGetSecondaryIndexBookmark
is > 0.

Tobias

Tobi

unread,
Mar 16, 2012, 9:06:06 AM3/16/12
to rav...@googlegroups.com
Digging a bit deeper into this:

JetGetSecondaryIndexBookmark is called for the "by_key" index which is
primary. May this be the issue?

Tobias

Tobi

unread,
Mar 16, 2012, 9:09:55 AM3/16/12
to rav...@googlegroups.com
On 16.03.2012 13:57, Tobi wrote:

> Map/reduce, which uses the OptimizedIndexReader as well, works fine on
> WinXP and the actualBookmarkSize returned by JetGetSecondaryIndexBookmark
> is > 0.

...my fault - wrong line. It's not primary.

Tobias

Tobi

unread,
Mar 16, 2012, 9:14:44 AM3/16/12
to rav...@googlegroups.com
Ha! Got it!

Modify your esent-only test program to create the index with:

CreateIndexGrbit.IndexDisallowNull | CreateIndexGrbit.IndexUnique

instead of just CreateIndexGrbit.IndexDisallowNull.

In this case, it fails on WinXP and prints:

Pri 0 Sec 20

But why?

Tobias

Tobi

unread,
Mar 16, 2012, 5:03:59 PM3/16/12
to rav...@googlegroups.com

Matt Warren

unread,
Mar 16, 2012, 5:28:22 PM3/16/12
to rav...@googlegroups.com
I know next to nothing about Esent, so I was just using the sample code posted above to play around and learn a bit.

But as I was reading the code sample here, I noticed this comment

// Be careful with ColumndefGrbit.ColumnNotNULL. Older versions of ESENT
// (e.g. Windows XP) do not support this grbit for tagged or variable columns
// (JET_coltyp.Text, JET_coltyp.LongText, JET_coltyp.Binary, JET_coltyp.LongBinary)

Don't know if this helps or not?

Oren Eini (Ayende Rahien)

unread,
Mar 18, 2012, 6:49:36 AM3/18/12
to rav...@googlegroups.com
Okay, that answer gives us the solution, I'll move to Api.JetGetBookmark, instead.

On Fri, Mar 16, 2012 at 11:03 PM, Tobi <lista...@e-tobi.net> wrote:
http://managedesent.codeplex.com/discussions/348886

Tobias

Tobi

unread,
Mar 19, 2012, 7:05:45 AM3/19/12
to rav...@googlegroups.com
On 18.03.2012 11:49, Oren Eini (Ayende Rahien) wrote:

> Okay, that answer gives us the solution, I'll move to Api.JetGetBookmark,
> instead.

I've cherry-picked this into stable and tested it - works fine!

Thanks!

BTW: Any plans for a new stable?

Tobias

Oren Eini (Ayende Rahien)

unread,
Mar 19, 2012, 8:20:17 AM3/19/12
to rav...@googlegroups.com
Soon

Justin A

unread,
Mar 19, 2012, 11:36:06 PM3/19/12
to rav...@googlegroups.com


On Monday, 19 March 2012 23:20:17 UTC+11, Oren Eini wrote:
Soon


 
Reply all
Reply to author
Forward
0 new messages