0

This morning our Amazon EC2 Windows server became nearly unresponsive, throwing 500 errors intermittently. In the CF log I see a bunch of these errors:

The request has exceeded the allowable time limit Tag: CFQUERY 

After rebooting the server, everything is back to normal.

While I hunt down the root cause for this, is it possible to configure CF Admin to send an email when a certain Log File error begins to appear several times in a row, like this one? We have already configured Health Status Checks for outages on EC2, but they never triggered because the server was still running, just incredibly slowly. I would like to be the first responder to situations like this but didn't know because I wasn't actively monitoring the server when it occurred - a user had to alert me to the problem a couple of hours later, which is embarrassing for me.

Thanks in advance!

Ben Chan
  • 240
  • 3
  • 10
  • I'm not associated with either company, but highly recommend you look at an analytics server to get an idea of what could be causing your problems. https://www.fusion-reactor.com/ or If you're not on Windows, https://docs.newrelic.com/docs/agents/java-agent.. You can get a trial of either. – Adrian J. Moreno Oct 16 '17 at 16:32

2 Answers2

2

Don't know if this is best practice, but what I do is utilize the OnError function in the application.cfc for reporting of unhandled errors.

<cffunction name="onError" returnType="void" hint="Runs when an uncaught exception occurs in the application.">
    <cfargument name="Exception" required=true/>
    <cfargument name="EventName" type="String" required=true/>

    <cfmail to="myemail@mydomain.edu" from="myemail@mydomain.edu" subject="Error Alert" type="html">
        <cfdump var="#session#">
        <cfdump var="#CGI#">
        <cfdump var="#Exception#">
    </cfmail>
</cffunction>

You could obviously filter down to the types of errors you want reported.

If you just want to check specifically in the function (where the time out occurred), then you should use:

<cffunction name="yourfunction">
    <cftry>
    ...
    <cfcatch>
        <cfmail to="myemail@mydomain.edu" from="myemail@mydomain.edu" subject="Error:yourfunction">
        <cfdump var="#session#">
        <cfdump var="#CGI#">
        <cfdump var="#cfcatch#">
    </cfcatch>
    </cftry>
<cffunction>
snackboy
  • 624
  • 3
  • 12
0

Query timeouts are not the only source of overwhelmed servers. You might want something more global.

What you can do on the CF Administrator app is to use Alert Configuration. Not only does this allow you to notify yourself if certain conditions are met, but you can also kill the problematic threads.

What we have done in addition to that, is to schedule a script on our development server to attempt an http request to the production server with a one second timeout. If the attempt fails, mail gets sent to people, pagers, and cell phones.

Dan Bracuk
  • 20,699
  • 4
  • 26
  • 43