tracker issue : CF-3511975

select a category, or use search below
(searches all categories and all time range)
Title:

9.0.1 CHF3 has a hard limit on the length of cfscript blocks

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Nick Walters / Nick Walters (fedsol)

Created: 03/03/2013

Components: Language

Versions: 9.0.1

Failure Type: Non Functioning

Found In Build/Fixed In Build: 9.0.1 /

Priority/Frequency: Critical / All users will encounter

Locale/System: English / Win 2008 Server R2

Vote Count: 0

Problem Description: A cfscript block longer than 45 lines causes error Invalid branch target position offset for jsr[168](3):-1: -1:

Steps to Reproduce: the following chunk of code works fine. If I add ONE MORE a=1; to it, it throws jsr[168] error.

<cfscript>
				blnBreak = false;
				if (qScores.AwayScore GT qScores.HomeScore) { //cos of ties
					if (qScores.HomeTeam Is useTeamID) {
						if (Not Len(streakStart)) {
							streakStart = "L";
							streakCount++;
						} else {
							if (streakStart Is "L")
								streakCount++;
							else {
								blnBreak = true;
								break;
							}
						}
					} else {
						if (Not Len(streakStart)) {
							streakStart = "W";
							streakCount++;
						} else {
							if (streakStart Is "W")
								streakCount++;
							else {
								blnBreak = true;
								break;
							}
						}
					}
				} else {
					if (qScores.HomeTeam Is useTeamID) {
						if (Not Len(streakStart)) {
							streakStart = "W";
							streakCount++;
						} else {
							if (streakStart Is "W")
								streakCount++;
							else {
								blnBreak = true;
								break;
							}
						}
					}
					a = 1;
					a = 1;
					a = 1;
				}
			</cfscript>

Actual Result:
jsr[168] compile error
Expected Result:
Previously compiled fine
Any Workarounds:
No workaround possible short of rewriting all cfscript blocks longer than the hard limit.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3511975

External Customer Info:
External Company:  
External Customer Name: fedsol
External Customer Email:  
External Test Config: CF 9.0.1 CHF3 Ent / Windows Server 2008 32-bit

Attachments:

Comments:

See video demonstration at http://screencast.com/t/E1gqKDjc
Comment by External U.
16118 | March 03, 2013 03:43:20 PM GMT
After finally diagnosing the flaw, I went to work on rewriting the affected code, but practically nothing I change makes this go away. I've got it throwing the jsr[168] error on just 2 lines of a = 1 alone in a cfscript block, which pretty clearly means I was wrong that it's the length of the cfscript that's the problem. It doesn't seem to be the length of the function either, since it works on some longer (incomplete) versions and fails on some shorter (incomplete) versions. I'm somewhat at a loss as to what the actual cause of the problem is, since no matter how I rewrite the affected code it keeps running into this error.
Comment by External U.
16119 | March 03, 2013 04:30:16 PM GMT
This eventually worked, removing the cfscript block entirely and replacing it with cfifs and cfsets: <cfset blnBreak = false> <cfif qScores.AwayScore GT qScores.HomeScore> <cfscript> if (qScores.HomeTeam Is useTeamID) { if (Not Len(streakStart)) { streakStart = "L"; streakCount++; } else { if (streakStart Is "L") streakCount++; else { blnBreak = true; break; } } } else { if (Not Len(streakStart)) { streakStart = "W"; streakCount++; } else { if (streakStart Is "W") streakCount++; else { blnBreak = true; break; } } } </cfscript> <cfelse> <cfif qScores.HomeTeam Is useTeamID> <cfscript> if (Not Len(streakStart)) { streakStart = "W"; streakCount++; } else { if (streakStart Is "W") streakCount++; else { blnBreak = true; break; } } </cfscript> <cfelse> <cfif Not Len(streakStart)> <cfset streakStart = "L"> <cfset streakCount++> <cfelse> <cfif streakStart Is "L"> <cfset streakCount++> <cfelse> <cfbreak> </cfif> </cfif> </cfif> </cfif>
Comment by External U.
16120 | March 03, 2013 04:39:21 PM GMT
I'm not able to reproduce this on CF 9.0.1.274733 Test: http://fusiongrokker.com/demo/cfscript_len.cfm Test Source: https://gist.github.com/atuttle/2848a35019088e7846b9 Note that I even added additional lines of cfscript to setup initial values for the variables used. No issues on CF10 either. It must be something environmental. Try on another computer/server/etc.
Comment by External U.
16121 | March 04, 2013 07:57:32 AM GMT
Re: Adam.Tuttle, as noted on prior notes, it is not actually about cfscript length, but I'm not allowed to edit the title. Watch the video, it's very blatantly a compiler problem that is brand new in CHF3. This code has been around since CF8 with absolutely zero problems; there's nothing wrong with it, it's perfectly legitimate CF code. It was suggested on forums that I note this is with Java 6. If we can no longer trust ColdFusion's compiler to actually compile perfectly valid ColdFusion code, well... what is a programming language that doesn't actually compile and run???
Comment by External U.
16122 | March 04, 2013 12:08:56 PM GMT