2 Replies Latest reply on May 8, 2009 6:30 AM by Al Baker

    Where is the mysterious hiding client variable?

    Al Baker Level 1

      Periodically we are getting this crash with one of our domains:


      Element CHOOSEEVENT is undefined in CLIENT.


      Here is the code snippet where the error is generated.  The last line gives the error.


      Note that the code is buried in a cfif testing for the existence of client.chooseevent and that the immediate preceding SQL statement references the variable successfully!


      <cfif isdefined("client.chooseevent") and not request.listevent>

      <cfif IsDefined("Client.CustomerID")

      AND (Client.CustomerID is not 0)

      AND len(Client.CustomerID)>

      <cfset str1 = client.customerid>

      <cfset str1=replace(str1,"-","_","all")>

      <cfif not isdefined("request.qrySeletedEvent_#client.chooseevent#_#str1#")>

      <cfquery timeout="#application.querytimeout#"

      name="qrySeletedEvent" datasource="#request.dsn#"



      SELECT * FROM evdata

      WHERE evID=#client.chooseevent#

      AND evdel = 0

      AND evCST ='#client.customerid#'


      <cfset request["qrySeletedEvent_#client.chooseevent#_#str1#"] = qrySeletedEvent>



      We are using the original release of ColdFusion 8 Enterprise.  Client variables are stored in a database and the domain is NOT being load-balanced between two CF instances.


      Any ideas?

        • 1. Re: Where is the mysterious hiding client variable?
          BKBK Adobe Community Professional & MVP

          Place <cfparam name="client.chooseevent" default="test_value"> at the top. Then place <cfdump var="#client#"> at two appropriate places, to find out where and how the variable disappeared.


          P.S.: for the test server, not on the production server!

          • 2. Re: Where is the mysterious hiding client variable?
            Al Baker Level 1

            Since the failure is a rare event, what I did instead was do a <cfsavecontent> of a <cfdump var="#client#"> after the initial <cfif> and after every statement between it and the last statement where the variable shows up missing.


            Around that last two statements I placed a <cftry> with the <cfcatch> sending me an email of all the dumps.


            After a couple of days it happened and, sure enough, variable "chooseevent" was in "client" after every statement except the <cfquery>.  After it, the variable no longer existed in "client".


            Which, of course, makes no sense.


            So, after the initial <cfif> I decided to do a <cfset holdchooseevent=client.chooseevent> and use "holdchooseevent" throughout the remainder of the body of the <cfif>.  After several more days, there have been no apparent problems.