Coldfusion timing out on large cfmail loop

tags266 used Ask the Experts™
Hi all,

I have a client who usually sends out approximately 20,000 emails per morning using a CF page.  The page queries the companies, then loops thru them and finds all the employees for each company, then loops cfmail.

This has worked just fine until we added 20,000 more emails to a particular company.  Now they are sending 40,000 from one company and a few from the rest in the loop.  What's happening is the page eventually dies, even though all the emails go out.  The mailing works for the first index, but the loop does not continue on to the other companies.  This was working fine before we doubled the size.

I was thinking, could it be a cfquery timeout?  From what i understand the cfquery timeout would extend the time it takes for an initial select statement (if there was a large recordset).  There are only 4 records (companies).  Would the timeout increase the length the recordset stays in CF memory.

What i think may be happening is in the following code below.

Does the cfsetting requesttimeout conflict with cfquery timeout?  Is that in the right place?

Additionally, i looked in all the logs, CF Logs, IIS logs, and there are no entries that say anything specific about timeouts so i am completely baffled.

<cfquery name = findcompanies>
get companies
<!--- the first instance of this loop works and happens to also be the company with 40,000 emails.  The loop does not continue, but does send out first.  It takes 28 minutes or so for the first loop to occurr.  Can the cfquery above be deleted in memory by they time the 2nd instance of this loop is created thereforre there's no recordset anymore for "findcompanies"
<cfset pagetimeoutvalue = "5000">
<cfsetting RequestTimeout = "#pagetimeoutvalue#">
<cfloop query = getcompanies>

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
System Architect, CF programmer
try putting this line on the beginning  of the page
<cfsetting requesttimeout="9000"


You think having it after the 1st query that finds the products the first cfquery could time out bc it appears before the cfsetting requestimeout?

Also, if a persons browser times out just due to his computer/browser settings, that loop should still continue on the CF server right?  I'm pretty sure that's the behavior.


As a side note, in my CF Administrator i have the Timeout Requests after ( seconds ) option UNCHECKED... So wouldn't the cfsetting requesttimeout be useless anyway, since my CF Admin doesn't have that option checked?  There should be no timing out.
erikTsomikSystem Architect, CF programmer

make that that option checked
Pravin AsarPrincipal Systems Engineer
Top Expert 2005
To speed up, you may precompile coldfusion code [cfm, cfc, etc].

This may save some time, by quicker loading of coldfusion components, etc.

Of course , increasing requesttimeout is another option, already suggested by others.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial