ColdFusion mail queue stops processing

后端 未结 7 1902
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-31 07:44

Our CF server occasionally stops processing mail. This is problematic, as many of our clients depend on it.

We found suggestions online that mention zero-byte fil

相关标签:
7条回答
  • 2020-12-31 08:12

    I have the same problem sometimes and it isn't due to a zero byte file though that problem did crop up in the past. It seems like one or two files (the oldest ones in the folder) will keep the queue from processing. What I do is move all of the messages to a holding folder, restart the mail queue and copy the messages back in a chunk at a time in reverse chronological order, wait for them to go out and move some more over. The messages which were holding up the queue are put in a separate folder to be examined latter.

    You can probably programmatically do this by stopping the queue, moving the oldest file to another folder, then start the mail queue and see if sending begins successfully by checking folder file counts and dates. If removing the oldest file doesn't work, repeat the previous process until all of the offending mail files are moved and sending continues successfully.

    I hope the helps.

    0 讨论(0)
  • 2020-12-31 08:16

    What we ended up doing:

    I wrote two scheduled tasks. The first checked to see if there were any messages in the queue folder older than n minues (currently set to 30). The second reset the queue every night during low usage.

    Unfortunately, we never really discovered why the queue would come off the rails, but it only seems to happen when we use Exchange -- other mail servers we've tried do not have this issue.

    Edit: I was asked to post my code, so here's the one to restart when old mail is found:

    <cfdirectory action="list" directory="c:\coldfusion8\mail\spool\" name="spool" sort="datelastmodified">
    <cfset restart = 0>
    <cfif datediff('n', spool.datelastmodified, now()) gt 30>
        <cfset restart = 1>
    </cfif>
    <cfif restart>
        <cfset sFactory = CreateObject("java","coldfusion.server.ServiceFactory")>
        <cfset MailSpoolService = sFactory.mailSpoolService>
        <cfset MailSpoolService.stop()>
        <cfset MailSpoolService.start()>
    </cfif>
    
    0 讨论(0)
  • 2020-12-31 08:16

    We have not tried to run this without using the queue, due to the large amount of mail we send

    Regardless, have you tried turning off spooling? I've seen mail get sent at a rate of 500-600 messages in a half second, and that's on kind of a crappy server. With the standard page timeout at 60 seconds, that would be ~72,000 emails you could send before the page would time out. Are you sending more than 72,000 at a time?

    An alternative I used before CFMail was this fast was to build a custom spooler. Instead of sending the emails on the fly, save them to a database table. Then setup a scheduled job to send a few hundred of the messages and reschedule itself for a few minutes later, until the table is empty.

    We scheduled the job to run once a day; and it can re-schedule itself to run again in a couple of minutes if the table isn't empty. Never had a problem with it.

    0 讨论(0)
  • 2020-12-31 08:17

    We have actually an identical setup, 32bit CF8 on Win2K3.

    We employed Ben's solution about a year ago, and that certain has helped auto re-queue emails that get stuck.

    However recently for no particular reason one of our 7 web servers decided to get into this state with every email attempt.

    An exception occurred when setting up mail server parameters. This exception was caused by: coldfusion.mail.MailSessionException: An exception occurred when setting up mail server parameters..

    Each of our web servers are identical clones of each other, so why it was only happening to that one is bizarre.

    Another item to note is that we had a script which reboot the machine in the middle of the night due to JRUN's memory management issues. The act of rebooting seemed to initiate the problem. A subsequent restarting of the CF service would then clear it, and the machine would be fine until it rebooted again.

    We found that the problem is related to the McAfee virus scanner, after updating it to exclude the c:\ColdFusion8 directory, the problem went away.

    Hope that helps.

    0 讨论(0)
  • 2020-12-31 08:19

    There is/was an issue with the mail spooler and messages with attachments in CFMX 8 that was fixed with one of the Hotfixes. Version 8.0.1, at least, should have had that fixed.

    0 讨论(0)
  • 2020-12-31 08:20

    Have you tried just bypassing the queue altogether? (In CF Admin, under Mail Spool settings, uncheck "Spool mail messages for delivery.")

    0 讨论(0)
提交回复
热议问题