tracker issue : CF-3345255

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

function call structure creation occasionally executes before the line in code is run

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/CannotReproduce

Reporter/Name(from Bugbase): Aaron Shurmer / Aaron Shurmer (Aaron Shurmer)

Created: 10/11/2012

Components: Core Runtime

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Final /

Priority/Frequency: Major / Very few users will encounter

Locale/System: English / Windows 7 64-bit

Vote Count: 0

Problem Description: calls to functions occasionally precompile the arguments before the line is called in code. this is specific to arguments that are structures being set up on the function call, so:

emailMessageBody = server.KonstrukFunctions.JREReplace( Text = this.EmailConfirmationBody, Pattern = '<img src="http://[^/]*/Admin/img/dynamic/image.cfm\?objectid=([^"]*)" />', Target = getRowContent, Scope = "all", AdditionalData = { this = this, stdata = attributes.stdata, rows = application.OS.aGet( this.arows ) } );//"

this will throw an error if attributes.stdata is not defined.

where it gets wierd is that no matter what you do prior to the line it will still throw the error. defining the variable has no effect, even abort; throw; exit; / etc have no effect, it still attempts to create the attribute AdditionalData structure prior to runtime execution of the line in question. Commenting out the line allows the preceeding aborts / etc to be executed.

Steps to Reproduce:
hard as there seems no rhyme nor reason to when the precompile of the structure is done, there must be a specific set of rules around when precompile occurs? when the problem does occur, it's reproducable every time you execute, but it's VERY rare that it happens - almost makes me think this is a problem with some code optimization in the compiler or some such.

Actual Result:
tries to create the function attribute AdditionalData = { this = this, stdata = attributes.stdata, rows = application.OS.aGet( this.arows ) } before the lines of code preceding it are executed - even throw and abort are ignored prior to the line. 

Expected Result:
lines of code bore getting executed

Any Workarounds:
commenting out the line will allow the code before to execute, also, taking out the function call structure creation and instead passing it a variable containing the structure fixes it, aka:

temp = { this = this, stdata = attributes.stdata, rows = application.OS.aGet( this.arows ) };
emailMessageBody = server.KonstrukFunctions.JREReplace( Text = this.EmailConfirmationBody, Pattern = '<img src="http://[^/]*/Admin/img/dynamic/image.cfm\?objectid=([^"]*)" />', Target = getRowContent, Scope = "all", AdditionalData = temp );//"

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

Watson Bug ID:	3345255

Deployment Phase:	Release Candidate

External Customer Info:
External Company:  
External Customer Name: AaronShurmer
External Customer Email:  
External Test Config: My Hardware and Environment details:

windows 7

Attachments:

Comments:

Hi Aaron, Do you have a full repro case we can try? I tried the following but am not seeing any error: index.cfm --------------- <cfinvoke component="MyCFC" method="MyFunction" returnvariable="myResult" /> <cfdump var="#myResult#" /> <cfdump var="#application#" /> <cfdump var="#server#" /> MyCFC.cfc ----------------- <cfcomponent> <cfscript> this.EmailConfirmationBody=""; this.arows=""; </cfscript> <cffunction name="MyFunction"> <cfscript> server.KonstrukFunctions = new KonstrukFunctions(); application.os = new OS(); var attributes.stdata=""; var emailMessageBody = server.KonstrukFunctions.JREReplace( Text = this.EmailConfirmationBody, Pattern = '<img src="http://[^/]*/Admin/img/dynamic/image.cfm\?objectid=([^"]*)" />', Target = getRowContent, Scope = "all", AdditionalData = { this = this, stdata = attributes.stdata, rows = application.OS.aGet( this.arows ) } );//" return local; </cfscript> </cffunction> <cffunction name="getRowContent"> <cfreturn "from getRowContent()" /> </cffunction> </cfcomponent> KonstrukFunctions.cfc --------------------------------- <cfcomponent> <cffunction name="JREReplace"> <cfargument name="text" required="no" /> <cfargument name="pattern" required="no" /> <cfargument name="target" required="no" /> <cfargument name="scope" required="no" /> <cfargument name="additionalData" required="no" /> <cfreturn "from JREReplace" /> </cffunction> </cfcomponent> OS.cfc ---------- <cfcomponent> <cffunction name="aGet"> <cfreturn "from aGet()" /> </cffunction> </cfcomponent> Thanks!, -Aaron
Comment by External U.
17583 | October 12, 2012 01:19:12 AM GMT
Sorry, didn't get email back about request for more info. unfortunately, without sending you the entire codebase that would be impossible, I've struck it a few times, but there isn't any seemingly logical reason for it, and as such it's not reproducible in a test case. i've also recently upgraded to CF10 across the board, and havn't struck the problem since. Maybe it's been solved in the compiler changes for 10. cheers, Aaron.
Comment by External U.
17584 | November 20, 2012 04:06:41 PM GMT
oh, i take that back, it's there in cf9 and 10.
Comment by External U.
17585 | November 20, 2012 08:22:29 PM GMT
this still occurs, and seems related to https://bugbase.adobe.com/index.cfm?event=bug&id=CF-3482734 the fix for CF-3482734 has not solved this issue. cheers, Aaron.
Comment by External U.
17586 | July 15, 2013 12:17:30 AM GMT
Aaron, have you come up with a portable repro case for this yet? It does just sound like a variation of CF-3482734. -- Adam
Comment by External U.
17587 | July 15, 2013 05:12:45 AM GMT
Could we have a reproducible case for this issue? We have not been able to reproduce this internally.
Comment by HariKrishna K.
17588 | December 16, 2013 05:33:26 AM GMT
This is a variation of numerous bugs that have cropped up relating to struct-literal syntax. Just do a search for "struct literal" or "implicit struct" in the bug base. There are a lot of issues relating to this. -- Adam
Comment by External U.
17589 | December 16, 2013 05:37:08 AM GMT
unfortunately probably impossible to create a reproducable case as it's obviously in the depths of some optimization code you have running and it's a specific case that must be pretty hard to come by. All I can suggest is that you look at the struct literal creation and make sure that it's not able to be created before it's used unless it's only static values used in the creation. It appears to only happen with struct literal creation as attributes to function calls.
Comment by External U.
17590 | January 23, 2014 04:27:27 PM GMT