Strange ColdFusion JRUN Stack Overflow Error

Posted August 11, 2010 at 7:31 PM by Ben Nadel

Tags: ColdFusion

This morning, I was doing some local ColdFusion development as I am normally; and, everything was working fine until I suddenly started getting this ColdFusion JRUN error:

java.lang.StackOverflowError at coldfusion.compiler.ExprAssembler.assembleExpr(ExprAssembler.java:144) at coldfusion.compiler.ExprAssembler.cast(ExprAssembler.java:1108) at coldfusion.compiler.StmtAssembler.cast(StmtAssembler.java:362) at coldfusion.compiler.ExprAssembler.assembleExpr(ExprAssembler.java:163) at coldfusion.compiler.ExprAssembler.assembleExpr(ExprAssembler.java:321) at coldfusion.compiler.ExprAssembler.cast(ExprAssembler.java:1108) at coldfusion.compiler.StmtAssembler.cast(StmtAssembler.java:362) at
.... etc.

I was in the middle of making a few updates across various files so, I just assumed that I must have changed something that created a weird memory leak. After commenting out a whole lot of code, I finally narrowed down the cause of the problem to an enormous, compound CFIF statement. This particular CFIF statement had well over 200 conditionals (don't ask), so I could maybe see that it was taking a bunch of memory; but, not only did I not believe that it was killing all of the RAM, it wasn't even part of the code that I was updating.

Starting to suspect that my code was not the culprit at all, I took a look at the Activity Monitor. There, I found out that JRUN was only using about 120MB or RAM. That might sound like a lot, but this sexy beast typically muscles ahead at close to 600MB of RAM. For one reason or another this computer decided to knock JRUN's legs out from under it?

Anyway, I restarted the JRUN server and the RAM went back up to about 570MB. The random stack overflow error was gone. I have no idea what caused it; but, I'm throwing it out there in case anyone else runs into the same thing.



Reader Comments

Aug 12, 2010 at 3:59 AM // reply »
10 Comments

Looks like during the CFML compilation process that the compiler exceeded the stack space (an area of memory - remember the JVM isn't all about heap memory). Looks like this was the Java stack size (vs native stack size) otherwise you would have seen a HotSpot dump file & error.
You can increase the Java stack size with JVM arguments if you think you need to with "-Xoss" and the native stack size with "-Xss".

Typically your stack size will be just a few hundred KB so activity monitor/task-manager/coldfusion-monitor isnt' going to give you any help here.

There's a ton of non-heap spaces to look out for in the JVM. Between you, I (and your blog readers!) FusionReactor v4 will very likely be helping in these areas - ssshhh, it's a secret!!


Aug 12, 2010 at 1:41 PM // reply »
11,314 Comments

@David,

I understood some of what you said there. The JVM is still a bit of mystery to me; although, I am slowly learning some of it. Installing CF as multi-instance mode has definitely helped me wrap my head a bit around the concept of the JRUN server and how things hook into it.

As far as what shows up in the Task Manager, it's usually super consistent regardless of whether or not I am using CF at the time or if I just booted it up.


Aug 13, 2010 at 10:15 AM // reply »
158 Comments

All,

Somewhat off topic, but not too far. I had some code that ended up spiking the proc and balooning the memory. In my case, a query was looking for its children, but I had made a small change that basically said, "Who are 'god's' children?" and then asked again and again the same question.

Needless to say, JRUN started chomping and wouldn't stop. It grabbed all of the data below the top parent then thought the child of the top parent also had a parent -- "God" had a parent (according to my code).

Took a long while to figure that one out because JRUN would run fine for minutes at a time! But, all the sudden, "Chomp, chomp, chomp." What happened is a user would run that particular query, and set off the chain reaction. I finally figured it out by opening Task Man and trying one thing -- waiting. Trying another, then waiting. I tried the query I thought was the problem, and sure enough it started spiking the processor.


Aug 13, 2010 at 5:40 PM // reply »
11,314 Comments

@Randall,

Yeah, there has got to be something that is causing a bottle neck in a random way. I say this because the pages that are timing out are ones that don't have a lot of processing. Most of the pages that get viewed on this site are Blog Entry pages; and, most of the data on these pages is getting cached. As such, there's got to be something that's causing a bottle-neck somewhere that is locking out page processing for a good period of time.

This weekend, I'll really scour my Application.cfc; I think I might be doing a lot of stuff in my onRequestStart() event handler.


Aug 18, 2010 at 8:28 AM // reply »
10 Comments

Hi Ben,

I'm curious to know if you've used FusionReactor on this server? I think it will help you a lot in tracking down your issues - especially if you've got pages timing out.

(Yes I'm biased and work for Intergral - the company behind FR)

Thanks,
D


Aug 18, 2010 at 9:54 PM // reply »
11,314 Comments

@David,

There's no particular reason I haven't used it yet; I think it's just one of those "server" things that I never felt all that confident with. When I got into programming, there was always someone at my companies who just handled that stuff for me. It is an emotional barrier that I simply have to overcome.


Jan 27, 2011 at 12:10 PM // reply »
6 Comments

My problem is slightly related, but thought I'd post in case someone else had the same problem I did. I was writing a custom tag I had named FirstData, whenever I would run it, it would cause a stackoverflowerror. Once I renamed the tag it worked fine, so I'm assuming First or Data were reserved words.


Feb 9, 2012 at 12:27 AM // reply »
1 Comments

Hi Ben,

When i login my application it throws the following error:
java.lang.StackOverflowError at coldfusion.runtime.NeoJspWriter.enablecfoutputonly(NeoJspWriter.java:372)

We are using Coldbox framework. Could you help me

thanks
B.Srinivasan


Feb 9, 2012 at 5:54 AM // reply »
10 Comments

Hello Srinivasan,

A common cause for that error is if you're doing recursion and your "exit condition" isn't being met. Think of the stack as the area of memory listing all the functions/points-of-code that you're jumping between. If you jump between lots of functions/points-of-code then you're going to have a large stack for the request. Typically the default stack size is just fine - I've not come across a valid reason to change it yet - and you'll want to adjust your code as you're probably doing something very inefficient.

Having said that, if you really think you need to adjust the stack size then "-Xoss" or "-Xss" are the JVM arguments you need to look at.

If Ben doesn't mind me plugging our own services then I'd point you at our CFconsultant brand where we'd be able to help you in a consulting engagement if you're looking for help resolving this.

Best regards,
David Stockton

Full disclosure: I work for Intergral, makers of FusionReactor and providers of CF consulting through the CFConsultant brand.


May 16, 2012 at 1:34 PM // reply »
6 Comments

Hey,

Recently I updated my jrun4 using the latest updater 7 and now i am having memory issues :(:(:( any help is appreciated


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
Jun 19, 2013 at 8:17 AM
My Experience With AngularJS - The Super-heroic JavaScript MVW Framework
@Prateek, to match a word or text you should use .toContain('word') that's a jasmine reference. website is : http://pivotal.github.io/jasmine/ ... read »
Jun 19, 2013 at 8:10 AM
My Experience With AngularJS - The Super-heroic JavaScript MVW Framework
Hi Guys, Actually i am doing e2e test of angular js of my project but i am not getting one thing that is how to press enter key through the test when my form is filled as i am not using a button but ... read »
Jun 18, 2013 at 9:20 PM
Mapping AngularJS Routes Onto URL Parameters And Client-Side Events
I couldn't find examples of passing multiple arguments using the when() routing statement so figured out through trial and error that you can pass multiple arguments using the following format: .whe ... read »
Jun 18, 2013 at 3:39 PM
Experimenting With The Amazon Simple Storage Service (S3) API Using ColdFusion
Hi Ben, THANKS! While not bleeding edge, it is new to me & I like learning new things every day! ... read »
Jun 18, 2013 at 12:30 PM
Disabling Auto-Correct And Auto-Capitalize Features On iPhone Inputs
Also spellcheck="false" should be mentioned as part of html5 specs ... read »
Jun 18, 2013 at 8:40 AM
Using Named Functions Within Self-Executing Function Blocks In Javascript
Hi Ben, you forgot to mention the most important thing for named self-executing functions - they can be referenced by name ONLY inside their execution context (which is parens in this case), it mean ... read »
dee
Jun 18, 2013 at 7:01 AM
My Safari Browser SQLite Database Hello World Example
hai ben, this program is really good i could understand the concept but i dint know how to save it and how to open it as you have done in the video can u give that details pls ... read »
Jun 18, 2013 at 6:04 AM
Clearing Inline CSS Properties With jQuery
Thanks a lot for for post! It helped me a lot... after being stuck since 24 hrs.. found solution from your post. Thanks again! ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools