Incomplete results from Get(...)

When I query a view for keys then retrieve documents for all of those keys I get inconsistent results. Every time I run I get a different number of results even though the key count is always the same. This is freshly-loaded data that has had three days to index and quiesce. No data has been deleted. The following is the code I am running:

            CouchbaseClient couchbaseClient = new CouchbaseClient();
            var rows = couchbaseClient.GetView("position", "position_timeseries")
                .StartKey(new object[] {"Position", 2012, 11, 1})
                .EndKey(new object[] {"Position", 2012, 11, 1, "\uefff"});
            var keys = rows.Select(p => p.ItemId).ToArray();
            var results = couchbaseClient.Get(keys);
            Console.WriteLine("{0} keys obtained, {1} items retrieved", 
                        keys.Count(), results.Count());

And I get results like the following consecutive runs:

1235 keys obtained, 1007 items retrieved
1235 keys obtained, 1021 items retrieved
1235 keys obtained, 989 items retrieved

Whereas I always get correct results when I request items singly as follows:

            var results = new List<string>();
            foreach (var key in keys)
                var result = CouchbaseClient.Value.Get<string>(key);
            Console.WriteLine("{0} keys obtained, {1} items retrieved", 
                        keys.Count(), results.Count());

Couchbase Version: 2.2.0 build-821
Couchbase Client Version: 1.2.9

1 Answer

« Back to question.

I'm updating this for future generations to search. Further investigation revealed the following error:

A first chance exception of type 'System.OutOfMemoryException' occurred in mscorlib.dll

Since this was building for x86 I tried building for x64 and it works every time. It looks like Couchbase drops results to the floor when memory limit is reached rather than allowing an exception to bubble up to the client. What's strange is that I don't encounter this when I load items one at a time, which in theory should have the same memory footprint as the multi-get.