tracker issue : CF-3811003

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

CFTRACE and trace() behave differently

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 08/24/2014

Components: Documentation

Versions: 11.0

Failure Type:

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Platforms All

Vote Count: 1

Listed in the version 2016.0.0.297996 Issues Fixed doc
Verification notes: verified_not_fixed on May 18, 2018 using build 2016.0.01.298513
Repro:

{code:java}
<cfif URL.tagsFirst>
	<cftrace category="test" text="trace text from tag 1">
		<cfset sleep(300)>
	</cftrace>

	<cftrace category="test" text="trace text from tag 2">
		<cfset sleep(500)>
	</cftrace>

	<cfscript>
	trace(category="test", text="trace text from script 1"){
		sleep(700);
	}
	trace(category="test", text="trace text from script 2"){
		sleep(1100);
	}
	</cfscript>
<cfelse>
	<cfscript>
	trace(category="test", text="trace text from script 1"){
		sleep(300);
	}
	trace(category="test", text="trace text from script 2"){
		sleep(500);
	}
	</cfscript>
	<cftrace category="test" text="trace text from tag 1">
		<cfset sleep(700)>
	</cftrace>

	<cftrace category="test" text="trace text from tag 2">
		<cfset sleep(1100)>
	</cftrace>
</cfif>
{code}


The tag version records the time of the block at the END of the block (which is correct). The script version records it at the beginning of the block (which is bloodly pointless).

Can't help but think you didn't test this.

It's the same in CF10.

-- 
Adam

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

Watson Bug ID:	3811003

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

Trace function does not support function body. To solve these kind of problems, we have added the generic syntax. Please use cftrace function for this. All future enhancements and bug fixes will be for cftrace function. cftrace(category="test", text="trace text from script 1"){ sleep(700); }
Comment by Himavanth R.
11247 | November 20, 2014 01:01:09 AM GMT
I've confirmed the following works: cftrace(category="test", text="trace text from script 1"){ sleep(700); } The trace doc says: "A function equivalent of the <cftrace> tag and is used in the <cfscript> mode." The word "equivalent" should probably be changed, since it isn't true (trace doesn't offer the equivalent functionality of cftrace, as we see here). Thanks!, -Aaron
Comment by External U.
11248 | November 23, 2014 11:43:05 PM GMT
Himavanth: your comment is incorrect: trace() certainly *does* support a "body", otherwise it would not compile. And obviously the intent is for it to work precisely as per the example in the ticket above. Don't be disingenuous and suggest that is not the case. At the very least you need to reopen this bug, change it's topic to be "documentation" and get the docs fixed. As well as deprecating the fact that trace() DOES support a body, it just doesn't do ti properly. TBH, falling back to the cftrace(){} version is just laziness on your part. In actual fact you never should have implemented cftrace() as you already had trace() in the language FOR OVER FOUR YEARS prior to to adding this generic nonsense. You should make trace() work. And you should simply implement cftrace() as a wrapper of it. That would be the professional approach here.
Comment by External U.
11249 | November 24, 2014 02:38:47 AM GMT
@Adam, we appreciate your contribution but certainly not the tone you use. No one is denying that it is a bug. However, since we have the generic syntax in place, there is no reason to make any change here. We will get the docs corrected. Opening it as a doc bug.
Comment by Rupesh K.
11250 | November 24, 2014 06:50:29 AM GMT
Hi Himavanth and Rupesh, Can you please confirm if writeDump(foo) returns "bar" for you, using the example below, on CF11 Update 3 (11,0,03,292245(PreRelease))? <cfscript> trace(text="trace text"){foo="bar";}; writeDump(foo);//outputs bar </cfscript> So what will be the "correction" to the docs? The trace doc cannot say "does not support a function body", b/c that is incorrect. It _could_ say "does not support a function body properly" - but that'd just be odd. Thanks!, -Aaron
Comment by External U.
11251 | November 29, 2014 07:15:53 AM GMT
Aaron: that's precisely my point. Whichever way one spins it, there is a *bug* here. If it doesn't support a body (which is just a cop-out), then it *mustn't* support a body. IE: it should error if one provides a body (like other CFScript constructs which do not support bodies). Rupesh, as for my tone: if you conducted yourselves honestly, professionally and with at least a nod to respecting your clients in matters such as this, then I'd adopt no "tone". And indeed the "tone" is merely me calling you out for NOT being professional, honest or respectful. Don't try to suggest the root of the problem here is how I *react* to the problem. You guys are the problem. -- Adam
Comment by External U.
11252 | November 29, 2014 08:14:22 AM GMT
Adobe, can you pls clarify what the resolution of this ticket actually was? If there is contention or disagreement or multiple ways the issue can be dealt with you *need* to feed back with "this is what's been done". Simple status changes don't work. Please - for the love of god - *get the message* about communicating with your clients. I believe that is a tone-appropriate way of delivering that message.
Comment by External U.
11253 | September 29, 2015 04:43:25 AM GMT
Adobe, There was a fair amount of discussion on this ticket. Can you please let us know what was/wasn't done? Thanks!, -Aaron
Comment by External U.
11254 | September 30, 2015 01:08:18 AM GMT
The trace() doc still says "A function equivalent of the <cftrace> tag and is used in the <cfscript> mode." That is obviously incorrect. (I hope we don't have to re-hash the previous discussion to make this obvious again) It looks like the docs were never updated. So, I'll repeat my question from last year: -------------------------------------------- So what will be the "correction" to the docs? The trace doc cannot say "does not support a function body", b/c that is incorrect. It _could_ say "does not support a function body properly" - but that'd just be odd. -------------------------------------------- Thanks!, -Aaron
Comment by External U.
11255 | September 30, 2015 01:12:44 AM GMT
+1 - trace() either needs fixed or documented as "does not support a function body properly"
Vote by External U.
11257 | September 30, 2015 01:13:39 AM GMT
It's not a function, either. And WTF is "CFScript mode"?
Comment by External U.
11256 | September 30, 2015 02:44:44 AM GMT
Hi Adobe, This issue was never fixed. <cfscript> trace() {sleep(2000);} </cfscript> That displays: [0 ms (1st trace)] This ticket needs re-opened/fixed. The issue wasn't a DOC bug; it was a BEHAVIOR bug !! After fixing this ticket, the "Note: This function differs from cftrace in that it picks the time at the beginning of the function execution instead of the end as is the case with cftrace." needs removed from atop the trace() doc. C'mon.. srsly.. no point in recording the time at the _start_ of execution. :/ Thanks!, -Aaron
Comment by Aaron N.
27868 | May 18, 2018 08:40:20 AM GMT