Thanks for getting back to me, Nigel. I also posted the problem in the Goliath google group, and its creator, Ilya Grigorik, posted that ruby fibers, on which Goliath relies, "have a *much* smaller stack, so this is not a bug.. you're likely simply hitting that limit" (his words and emphasis). So it could be that I was well within "normal" (i.e., non-fiber) stack limits when not calling my code from Goliath, but with Goliath/fibers in the equation, I ran out of room.
I've researched the ruby fiber stack a bit, and found this: http://redmine.ruby-lang.org/issues/3187, so it seems that 1) there are other folks running up against this limit and 2) changing the system stack size might not make a difference -- but I'm gonna give it a try, anyway! Thanks again. On Sun, Nov 27, 2011 at 6:54 AM, Nigel Thorne <[email protected]> wrote: > As no-one has responded, I thought I would chip in... > > I'm sure you probably know this... but just in-case, > > "Stack too deep" literally means you have too many functions calling onto > other function, detected by the virtual machine (or OS) to prevent you from > getting run away recursion. > > So.. causes.. > > Either someone is monkey patching something that Parslet is relying on, so > the code that is executing is different somehow, > > OR > > You are just unlucky, and were running near the stack limit with your > existing code but didn't know it and running it from within another calling > mechanize has just pushed you over the edge (as it would add it's own calls > to the stack). > > Parsing can be a very stack intensive activity depending on the > implementation and the complexity of the document. I believe Parslet will > be creating another call on the stack for each sub-entity it starts > parsing... so if you have expressions that contains expressions that > contain expressions.. etc... > then at some point you'll hit the limit.. > > Solution? > > I'd suggest trying to set your stack depth a little deeper ( > http://dalibornasevic.com/posts/5-ruby-stack-level-too-deep-systemstackerror) > first.. and see if that's the problem. If you still hit it, then you > probably have some run away recursion.. so the code is somehow different in > the Goliath environment. If it starts working, then you just have a deep > stack. > > Either you can make this your default stack depth setting, or change your > grammar to reduce the number of rules and hence the stack depth. > > These are just my suppositions, so I hope they are of some help. > > > Cheers > Nigel > --- > "No man is an island... except Philip" > > > > On 27 November 2011 07:32, David Jenkins <[email protected]> wrote: > >> I have an app that uses Parslet and works fine in "normal" circumstances. >> But the same code, when called called from Goliath.response, gives me >> "error: stack level too deep". >> >> Any ideas? >> >> I'll try and whittle down the code to a reasonable repro size in the >> meantime. >> >> Thanks >> >> David Jenkins >> > >
