This project has moved and is read-only. For the latest updates, please go here.



We've been running the following query quite many times during the last few weeks, but this time it threw StackOverflowException:
 var data = storage.CreateQuery().Where(x => x.PartitionKey == partition).ToList();
The stack trace only contains the following:

System.StackOverflowException was unhandled

But the call stack may reveal some more info:
    Lucifure.Stash.dll! System.Collections.Generic.IEnumerable<System.Collections.Generic.IEnumerable<CodeSuperior.Lucifure.NameValue>> next) Line 129 + 0x112 bytes F#
    [External Code] 
    Lucifure.Stash.dll! System.Collections.Generic.IEnumerable<System.Collections.Generic.IEnumerable<CodeSuperior.Lucifure.NameValue>> next) Line 122 + 0x16a bytes F#
    [External Code] 
    Lucifure.Stash.dll!<StartupCode$Lucifure-Stash>.$QueryProvider.query@73-1<Wensus.DailyApplicationEventRow>.GenerateNext(ref System.Collections.Generic.IEnumerable<DailyApplicationEventRow> next) Line 87 + 0x124 bytes    F#
    [External Code] 
>   datacacher.tests.dll!datacacher.tests.All.Run() Line 37 + 0x1f2 bytes   C#
The last line at the bottom is our code. The call stack is filled with lines containting "GenerateNext". It seems the GenerateNext hit an endless loop.

Visual Studio highlighted XmlResponseParser.fs' line 117 as the problem:
115 let rec read nameValues =
116            seq { 
117                if reader.Read() then
118                    if reader.NodeType = XmlNodeType.Element then
119                        match reader.LocalName with
And here's the Visual Studio's message about the unhandled exception:

An unhandled exception of type 'System.StackOverflowException' occurred in System.Xml.dll


wrote Feb 20, 2013 at 6:17 AM

Associated with changeset 20036.

hocho wrote Feb 20, 2013 at 6:21 AM

I believe I identified and fixed a recursive call which was not tail-end.
Let me know, if you can still duplicate the error.
Thanks for the detailed error message.

Miksu wrote Feb 20, 2013 at 4:46 PM

Great, the latest code seems to have fixed our issue. Thanks!