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,238 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,238 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,238 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
May 21, 2013 at 7:46 PM
Using Plupload For Drag & Drop File Uploads In ColdFusion
No luck. At least I have uncovered the cause, URLScan 3.1. Here is what I see in the IIS log when a file is over 30mb. 2013-05-21 23:29:05 10.105.45.128 GET /plupload/assets/jquery/jquery-1.8. ... read »
May 21, 2013 at 6:12 PM
Using Plupload For Drag & Drop File Uploads In ColdFusion
Ben, I did not see you after Pete Freitag's Lockdown session at cfObjective but he said that IIS sets file size limits at 30MB by default which just happened to be the threshold for file size when ... read »
May 21, 2013 at 11:51 AM
Ask Ben: Parsing Very Large XML Documents In ColdFusion
Looking at my first ever XML document that I have to parse and put into MS SQL 2000 with CF8. I get it to list the desired Field name, many times over, and have a long list of this field name displa ... read »
May 21, 2013 at 9:25 AM
Turning Off and On Identity Column in SQL Server
you are awesome..i am lucky to get this blog between such a garbage one....Thanks, Prashant ... read »
May 20, 2013 at 4:38 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
@Dana, Your confusion is well founded, since this is a very confusing features. In fact, it ONLY works if you use array notation. Meaning, that this: arrayToList( query[ "columnName" ] ) ... read »
May 20, 2013 at 4:34 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
I was thinking chicken and the egg, I wouldn't have expected it to work in the valuelist going in I guess. Maybe I just need a beer, long day :) ... read »
May 20, 2013 at 4:29 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
@Dana, That's if you're trying to reference a specific row. In this case, we're trying to reference the entire query column as one cohesive value. So, you are correct that if you wanted to output a ... read »
May 20, 2013 at 4:24 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
I thought when you used array notation to reference queries you always had to have the row or it would throw a similar error as well? ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools