multithreadingcoldfusioncfthread

CFThread Arguments vs Attributes


For years, I've been using the following code across multiple ColdFusion environments:

<cfthread 
    action                  = "run" 
    name                    = "#Local.cachedFilename#"
    src                     = "#Arguments.src#"
>

    <!--- Process  image --->
    <cfset Local.objImage = This.processImage(
        src                     = Arguments.src
    ) />

</cfthread>

I've come to reuse my component in a different environment today and for the first time I've hit an error, that Arguments.src does not exist inside the thread.

A bit of Googling returned an answer, I should be using the attributes scope inside a thread... so the ProcessImage call makes use of Attributes.src instead of Arguments.src.

This works fine. All is well. But I'm confused.
I wrote this code for Railo. It worked fine. I ported it over to CF10, it worked fine. I ran it on CF11. It worked fine. The first time I've come across an error is on a particular box, also running CF10.

So my question is - was there an update somewhere, or is there some particular set of circumstances, that would allow me to use the arguments scope inside a CFThread? Essentially if I'm supposed to be using the attributes scope, how have I had this working fine for years?!


Solution

  • CFThread is a tag, not a function call. It therefore has attributes, not arguments. It would appear that Railo/Lucee for some reason incorrectly make the attributes available in an arguments scope as well. Adobe's behavior is correct IMO and you just got away with it by luck in the past on Railo.