Odd problem with mail queue

I wrote a scheduled job that checks the Tasks folder hourly for undelivered emails. I did this so that we can get an email notification when there are undelivered mail left there. However, it seems to have uncovered another problem that I can’t pinpoint.

Here’s an example of the output

  1. 00000386.tsk 18-Jun-2017 09:45:42
    See https://my.domain.com/lucee/admin/web.cfm?action=services.tasks

  2. 00000311.tsk 18-Jun-2017 09:36:39
    See https://my.domain.com/lucee/admin/web.cfm?action=services.tasks

  3. 00000310.tsk 18-Jun-2017 09:28:20
    See https://my.domain.com/lucee/admin/web.cfm?action=services.tasks

Note the times on these. Isn’t the Lucee mail queue supposed to send messages on-demand or within 5 minutes? It seems like messages from the last hour stay in the queue for a LONG time instead of delivering.

To add to the mystery, when I look as the Tasks page in the Lucee admin it says that there have been 0 attempts. So, the messages are not failing. It’s not even attempting to send them.

The messages seem to deliver at some point within the hour, though. When the scheduled job runs the following hour, all those messages are gone and delivered.

Can you think of any reason why messages are being held for so long before attempting to send?

(Lucee on Windows 2008R2 with IIS)

I ended up finding the issue here. There are multiple load-balanced servers sharing one context folder. A couple of those servers had not been cycled since they were installed. Something about the mail queue listener just wasn’t firing if the message originated from one of the new servers. As soon as an email came in on one of the older servers, it would trigger everything to get sent. To resolve, I recycled Lucee on the newer servers. All emails are sending correctly now.