views:

419

answers:

7

coldfusion.compiler.FactoredNodeAggregation cannot be cast to coldfusion.compiler.ASTfunctionDefinition

I get the above error when attempting to replace a really, really old legacy custom tag with a new custom tag that has some substantial workflow improvements. I only have one idea on how to debug this: comment out different parts of the code (binary search style) until it will compile, narrowing my search until I find the problem code.

Has anyone else ever seen this error before? Any idea what it could possibly be? Contextually, it sounds like I'm trying to use ... something... as a function that isn't defined as a function. That doesn't ring a bell so I'm going to try the binary search idea.

Update: It's running on CF 8.0.1, and doesn't use any <cfscript> blocks at all. Using the binary search of commenting out, I've narrowed it down to a CFThread that starts a background thread that never re-joins the page (by design).

If I comment out the entire contents of the thread, the error goes away (so the cfthread tag itself doesn't appear to have problems on its own...). If I copy the contents of the thread to its own template, that template will compile fine (so the thread contents doesn't appear to have problems on its own...)... so... in theory it should work? I don't know. This is me with my arms up in the air. (WTF?)

I think I've already disproven this idea by un-commenting a small section without the error coming back, but a CFThread should have access to local custom tags that the template creating the thread would have, right? so if there's foo.cfm, it could be accessed from the page as <cf_foo>, and the thread could do the same?

A: 

Oooh, that's one I've not seen before.

Depending on what the custom tag does, rather than commenting out different parts, you could try using cfabort - same technique, but only one line to change rather than uncommenting and re-commenting (which can be fiddly and time-consuming).

Also, are you able to test the custom tag in isolation, with completely simplified arguments/etc?


If you're able to post the code, there might be something odd that jumps out at a fresh pair of eyes?

Peter Boughton
Since the problem code runs in a background thread, and as I noted in my update to the original question, copying the contents of the thread to its own template compiles fine, I don't think cfaborts will help. :(
Adam Tuttle
A: 

that error usually comes up when you have a function that is set to remote. kinda funny that your getting it with a custom tag though. are you sure that the custom tag doesn't have any functions in it? can you post the code?

rip747
No UDFs here. :-\
Adam Tuttle
A: 

Strange that it is a compilation error. If the code base is not too huge I would make sure all variables in the thread and called udfs are explicitly scoped.

Next I would move as much externally referenced data into the thread arguments scope to isolate the interactions with the page.

Finally if that does not clear it up I would try mangling the names of every variable, function and udf the thread accesses a bit with some test prefix just to make sure that you have not hit a bug where one of your vars or funcs is causing a namespace collision in the jvm in the context of the original page.

Tricky problem.

kevink
A: 

Have you deleted the compiled class files and saved the original source to a new file just in case something weird occurred during a save?

Aaron Greenlee
A: 

Have you tried reinstalling CF8.01? Maybe some files got corrupted?

Henry
+2  A: 

In the last week I've been in contact with the ColdFusion Engineering team at Adobe about this issue and they confirmed for me that this is a bug in ColdFusion.

Specifically, if the number of lines of code inside the thread tag body was too large, it would cause a compile error. The work-around, which I discovered a day or two before I got my answer, is to use a <cfinclude /> to import your thread contents from another file; or to put the code into a method somewhere and call that method from inside the thread body. (Presumably, a custom tag or other clever methods of encapsulation would also work.)

That explains the part of the whole thing that was driving me absolutely insane: that commenting out various parts of the thread body would sometimes make it compile... and now I know it was because enough of the thread body was commented out.

They report that they have fixed the bug, so I assume it will be fixed in the next cumulative hot-fix (if there is one), and in ColdFusion 9.

Adam Tuttle
i voted your response up, but could you accept your own answer?
rip747
I was under the impression that you couldn't accept your own answer. Maybe that was a rule in the beta but you can now? Not sure... I've accepted it now. Thanks for the nudge.
Adam Tuttle
You can accept your own answer after 48 hours.
Tomalak
+1  A: 

Since I can't comment yet, Adam, is it really a bug with CF or with the JVM? There's a similar limit on how many lines of code can be compiled within a CFFUNCTION, but the limit is really in the JVM, not the CF tag.

iKnowKungFoo
I voted you up, hopefully that helps you get commenting ability sooner. :)What Adobe told me was that it was a bug, and that they've fixed it. To quote, "a bug in the code generation" -- so my best guess is that it's a problem converting the CFML to JSP. That's all I can say for sure.
Adam Tuttle