Skip to main content
January 19, 2011
Question

Random Crashes

  • January 19, 2011
  • 3 replies
  • 1094 views

For some time now I have been seeing an error appear in the Coldfusion 9 error log. I have had clients call up about a GSD from this error. The error is as follows:

"Error","jrpp-14143","01/18/11","07:38:06","XXX","The value '' cannot be converted to a number. The specific sequence of files included or processed is: C:\Inetpub\wwwroot\www.XXX.com\XXXXX.cfm, line: 256 "

coldfusion.runtime.Cast$NumberConversionException: The value '' cannot be converted to a number.

This most of the time is not a problem and the program runs flawlessly. It is at random times that this error occurs and there is no way to reproduce this error in the test environment or in production. The line it points to are all variables that are set to literals or in a CFLOOP. They are all set by the server, not a human. I am having problems trying to figure this one out.

code:

<table id="2R-#count#" <cfif count LTE RmaxFirstShow OR ( count NEQ (RmaxFirstShow+1) AND ( StructFind( Evaluate(XXX) , "XXX#count#" ) NEQ "" OR

( count GT 2 AND

StructFind( Evaluate(XXX) , "XXX#count-1#" ) EQ "") ) )>style="display:none;"</cfif>>

Every variable here, with the exception of the struct in the session, are set by the code and not any human. They are all integers.

Any help on this would be much appreciated.

EDIT: Correcting code. Adding in ")" that was missing but actually in the working template.

    This topic has been closed for replies.

    3 replies

    BKBK
    Community Expert
    Community Expert
    January 19, 2011

    [post deleted: came in too late]

    BKBK
    Community Expert
    Community Expert
    January 19, 2011
    The value '' cannot be converted to a number.

    In my experience, that error message usually shows up where you attempt to use '' as an operand in an arithmetic operation. The line of code you've shown contains two operations, namely

    RmaxFirstShow+1
    count-1

    I would therefore conclude that the error is caused by either RmaxFirstShow or count taking the value ''. Put the following just before that line, and examine the log file.

    <cflog file="debugBlankString" text="RmaxFirstShow=#RmaxFirstShow#;count=#count#"><cfabort>

    Inspiring
    January 19, 2011

    Regarding:

    In my experience, that error message usually shows up where you attempt to use '' as an operand in an arithmetic operation. The line of code you've shown contains two operations, namely

    In my experience, it's caused by receiving a null value from a numeric field in a database record.

    January 19, 2011

    The data base field that is pulled in is defaulted to 3 and nulls are not allowed.

    Up above this line there is the following code:

    <cfset RmaxCount = 10>

    <cfset RmaxFirstShow = 3>

    <cfquery name="GetXXX" datasource="#XXX#">

    SELECT XXX1

    FROM XXX2 WITH ( NOLOCK )

    WHERE XXX3 = '#ATTRIBUTES.XXX3#'

    </cfquery>

    <cfif GetXXX.XXX1LT RmaxFirstShow>

    <cfset RmaxFirstShow = GetXXX.XXX1>

    </cfif>

    <cfloop from="1" to="#RmaxCount#" index="count">

    Edit: And why would from one moment the database return a null value, and next return a number value? There is no place in this section of the code that would change that field.

    Inspiring
    January 19, 2011

    Start by looking at lline 256 and see what variable is supposed to be converted to a number.  Then determine how that variable gets it's value. 

    If possible, get any input parameters from the victims.

    January 19, 2011

    I have looked at that line, like previously stated, all values are set by the code and not any user input. These variables have nothing to do with the data from my client, they are just controls on the display of the data. How many input box sets to show when. Everything that would be converted to a number is tightly controlled by the code. No user error possible.

    Oh, and it will crash on a file but if you refresh the crash goes away. That is a sign it is user data independent.