Ian White
asked on
Baffling ColdFusion Random Error CF11 referring from another site
Every now and again I get error see below. It is traffic linking through from various sites. I go to the referring site and follow their link and it goes through OK
Any idea what causes this in my site index.cfm? And what does the <pre> mean? Any idea how to prevent?
Any idea what causes this in my site index.cfm? And what does the <pre> mean? Any idea how to prevent?
example 1
ErrorDate Thu Jul 23 23:49:50 CDT 2015
Browser Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.89 Safari/537.36
Remote Address 1.171.166.141
HTTP Referrer http://random-referring-site
Template /index.cfm
Query String
HTML Code Format <PRE>null null <br>The error occurred on line -1.</PRE>
example 2
ErrorDate Thu Jul 23 22:47:38 CDT 2015
Browser Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36
Remote Address 61.3.56.138
HTTP Referrer http://random-site2
Template /index.cfm
Query String hop=xxxxxx
HTML Code Format <PRE>null null <br>The error occurred on line -1.</PRE>
ASKER
Ok Thanks for your help. No don't use client variables. I use session variables only. I trap in the application.cfm route to error page then display the error and send myself an email with the error.
From application.cfm
......
<CFSET PATH=GETDIRECTORYFROMPATH(#CGI.CF_TEMPLATE_PATH#)>
<CFIF (CGI.CF_TEMPLATE_PATH IS NOT "#path#error_request2.cfm")
AND (CGI.CF_TEMPLATE_PATH IS NOT "#path#error_request.cfm")>
<CFERROR TYPE="REQUEST"
TEMPLATE="error_request.cfm"
MAILTO="systemadmin@foo.com">
</CFIF>
....
<!--- error_request.cfm --->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="robots" CONTENT="noindex">
<TITLE>House Carers</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff" onLoad="document.ErrorForm.submit()">
<DIV ALIGN="center">
<FONT FACE="Arial" SIZE="2">
<HR>
<H3>The Application Has Encountered a Request Error!</H3>
<HR>
<H4>Please wait while the administrator is
notified....</H4>
<FORM ACTION="error_request2.cfm"
METHOD="POST"
NAME="ErrorForm">
<INPUT TYPE="Hidden"
NAME="ErrorDate"
VALUE="#Error.DateTime#">
<INPUT TYPE="Hidden"
NAME="Browser"
VALUE="#Error.Browser#">
<INPUT TYPE="Hidden"
NAME="RemoteAddress"
VALUE="#Error.RemoteAddress#">
<INPUT TYPE="Hidden"
NAME="HTTPReferer"
VALUE="#Error.HTTPReferer#">
<INPUT TYPE="Hidden"
NAME="Template"
VALUE="#Error.Template#">
<INPUT TYPE="Hidden"
NAME="QueryString"
VALUE="#Error.QueryString#">
<INPUT TYPE="Hidden"
NAME="MailTo"
VALUE="#Error.MailTo#">
<TEXTAREA NAME="Diagnostics"
COLS="42"
ROWS="1"
WRAP="VIRTUAL">#Error.Diagnostics#</TEXTAREA>
</FORM>
<HR>For questions please email:
<A HREF="mailto:#Error.MailTo#">#Error.MailTo#</A>
</DIV>
</BODY>
</HTML>
<!DOCTYPE html>
<html class="no-js">
<head>
<META NAME="robots" CONTENT="noindex, nofollow">
....
</HEAD>
<body id="why" class="no-top-nav left-main">
<div id="wrap">
......
</nav>
-->
<h1 class="top-headings">Internal Error...</h1>
</div>
</header>
<!-- Main Content BEGIN -->
<div id="middle">
<section id="main" class="container" role="main">
<div class="left-col">
<article>
<CFIF NOT ISDEFINED("FORM.Diagnostics") AND
NOT ISDEFINED("FORM.ErrorDate") AND
NOT ISDEFINED("FORM.Browser") AND
NOT ISDEFINED("FORM.RemoteAddress") AND
NOT ISDEFINED("FORM.HTTPReferer") AND
NOT ISDEFINED("FORM.Template") AND
NOT ISDEFINED("FORM.QueryString")>
<cfoutput>
<p>
An internal server error has occurred, but our
squad of CF Ninjas are looking into it! Naturally,
you won't be able to tell that they're doing
anything because they are Ninjas! But, rest assured,
stuff is getting done.
</p>
</cfoutput>
<cfelse>
<CFOUTPUT>
<cfmail to="systemadmin@foo.com" from="mailadmin@foo.com" subject="Error has occured" >
ErrorDate #FORM.ErrorDate#
Browser #FORM.Browser#
Remote Address #FORM.RemoteAddress#
HTTP Referrer #FORM.HTTPReferer#
Template #FORM.Template#
Query String #FORM.QueryString#
HTML Code Format #HTMLCodeFormat(FORM.Diagnostics)#
</cfmail>
<H3>The Application Has Encountered an
Error!</H3>
<HR>
<p>
Here is some of the information that has been
submitted to the site administrator. <P>
<UL>
<LI><B>Date of the Error:</B> #FORM.ErrorDate#</LI>
<LI><B>Browser being used:</B> #FORM.Browser#</LI>
<LI><B>Remote Address:</B> #FORM.RemoteAddress#
</LI>
<LI><B>Page on which error occurred:</B>
#FORM.HTTPReferer#
</LI>
<LI><B>HTTP Referrer</B> #FORM.HTTPReferer#
</LI>
<LI><B>Template</B> #FORM.Template#
</LI>
<LI><B>Query String</B> #FORM.QueryString#
</LI>
</UL>
</P>
<TABLE class="ErrorTable">
<th>HTML Code Format</th>
<TR>
<TD>#HTMLCodeFormat(FORM.Diagnostics)#</TD>
</TR>
</table>
<p>
<B><A HREF="index.cfm">Click here for Foo Home
</A></B>
<HR>For questions please click the contact link below
</p>
</CFOUTPUT>
</cfif>
</article>
......
</body>
</html>
What did you find in the logs?
Also, in addition to checking the logs:
A) Are you including "error.generatedContent" in the debugging information? That variable is available for "request" handlers and might provide more details.
B) Does the application have an "exception" handler? Unlike "request" handlers, those can include cfml code.
A) Are you including "error.generatedContent" in the debugging information? That variable is available for "request" handlers and might provide more details.
B) Does the application have an "exception" handler? Unlike "request" handlers, those can include cfml code.
ASKER
Thanks How do I set up A?
No I only have a request handler.
Can you point me to a exception handler?
So the exception handler handles everything ? Including request errors?
Do I change the request handler to an exception handler?
No I only have a request handler.
Can you point me to a exception handler?
So the exception handler handles everything ? Including request errors?
Do I change the request handler to an exception handler?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for your help
In my case, I checked the logs and the exception trace was really generic, like "NullPointerException". Not very useful since NullPointerException can occur with any code at all. Fortunately, it was reproducible in the app, but because it's so generic I ended up having to comment out code an try it a few lines at a time .. arduous, but eventually located the problem. Turned out to be some obscure problem with the framework the app was using.
Before you go that route, check all of your logs ({cf_root}\logs\ and {cf_root}\runtime\logs\ ) for errors around that time period and post the full trace here. Don't truncate the traces because any "caused by" sections will appear at the bottom of the trace.
Also, how are you trapping the above error? ie Specially what error handling is used in the application, Application.cfc/OnError, Application.cfm/cferror ?