stack overflow

he following code (based upon a scheme that has been running for about a year) is currently successful. However, upon completion(?), it generates a "stack overflow line: 0" error.

1. document.ready() examines a library, and sets a control button if the condition is realized.
2. The button sets off processRecord, which does the same thing but with a sort-by-date clause.
3. Then, it iterates through all candidate items, opening the (email) file and extracting its content. Certain items in that content are to be entered in a list.
4. doStuff processes that content data, and with findExisting checks to see whether the item is already in the list.

If findExisting is disabled, there is no stack overflow error.

If findExisting is enabled, processing results are as intended but a stack overflow error is generated.

Thanks. We're a government installation, so are at MOSS with IE7--no debugging possible. I'll first try the async: false trick, then try the code on an SP2010 machine and IE9 (not used in-house but would help understand whether the problem is IE).

The "stack overflow..." message is an information dialog that is system-generated. Appears after the writes to the list, so far as I can tell.

I think it's clearer now, and I think you're right to wonder whence originates the stack overflow message. My guess is that it is the browser. Over the past few days, when I have had many dialogs come up in the debugging process, I got used to seeing a stack
overflow message, and I just automatically assumed that was because the instance of IE7 could not handle all those dialogs (almost certainly, given our environment, due to lack of RAM).

Now, I have just put everything on to a MOSS virtual machine that runs under sufficient RAM (and, admittedly, with IE8), and have run the same code against the same data samples, and there was no error message.

So, let's presume--until proven wrong--that the error is due to limitations of the browser.

By the way, also putting this application on SP2010 showed clearly that another of the SPServices instances needs async:false. So, that makes three. The rest did not generate any problems with the default value.

Your instincts have prevailed, and the browser appears to be the culprit here.

Boy, this was interesting. I searched Bing for: [Internet Explorer 7 "stack overflow"], and found a lot of hits. One in particular caught my attention: "recursion that passes through the host global object is limited to a stack depth of 13"
[I didn't note the URL but searching for that string should find it in Stack Overflow].

After many experiments, I found that if I enclose the SPServices call that occurs within the writeNew function (above) with:
if(iGlobal < 13) { ...}
then all is well. If I increase the limiter to, say, 15, the application (not the iteration) ends with a "stack overflow" message.
Trying to understand his next sentence, I removed the Crockford module pattern I use with most of the SharePoint JavaScript code, but it made no difference.

It's really hard to debug stuff like this from afar. I don't see anything obviously wrong with what you're doing. I'd suggest stepping through it in a debugger to see if you're nesting recursively or something.