Duncan’s blog

April 14, 2009

ColdFusion scheduled task bug

I just discovered this bug with scheduled tasks in ColdFusion Administrator today. I think I’ve encountered it before but didn’t realise at the time what had happened.

I was updating a scheduled task to run in the future. I then decided to just run it manually instead. To make sure the scheduled task didn’t run as I’d originally planned, I just put the date into the past. I didn’t want to delete the scheduled task as it’s one that is run occasionally as and when required.
ColdFusion Administrator scheduled task screen

What I found was that when I edited the scheduled task to be in the past, it actually ran immediately! If you edit it again to another date in the past, it’ll run again. Luckily the scheduled task I was working on wasn’t that important, but some scheduled tasks (especially one-off ones) might have more serious consequences if they run when you’re not expecting it.

I found two ways to replicate this bug.
Method 1:

  1. Create a new scheduled task in CF Administrator.
  2. Set it to run one time with a date in the past, say yesterday at 9pm.
  3. Save the scheduled task.

Method 2:

  1. Create a new scheduled task in CF Administrator.
  2. Set it to run one time with a date in the future, say tomorrow at 9pm.
  3. Save the scheduled task.
  4. Edit the scheduled task, and change the date or time to the past, say 9pm yesterday.

So basically any time you create or update a scheduled task, running ‘One-Time’ but with a date/time in the past, it’ll run immediately!

I noticed this bug in Adobe ColdFusion 7 and 8 Enterprise, and ColdFusion 8 Developer edition. I’d be surprised if it happens in Railo or OpenBlueDragon. Bug reported at Adobe’s Bug Report Form.

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.