BUG: Closed task thread IDs reused after Lucee restart

Hey guys. First here’s my stack info:

OS: Linux (5.4.59) 64bit
Java Version: 11.0.11 (AdoptOpenJDK) 64bit
Tomcat Version: Apache Tomcat/9.0.11
Lucee Version: 5.3.6.61

It seems there’s a bug with task threads. Not sure if it’s been fixed in Lucee versions later than mine, but here’s how to cause it:

  1. Make sure there are no task threads (delete all if needed).
  2. Shutdown Lucee.
  3. Start Lucee.

These three steps appear to ensure that when we create a task thread, it’ll have ID = 1.

  1. Create a task thread that always fails (contains just a CFTHROW for example). It will be given ID = 1.
  2. Repeatedly execute it (either manually or just wait for all its retries to happen) until it’s “closed” and appears in red in the adminstrator “Services - Tasks” page.
  3. Shutdown Lucee.

Here’s the fun part:

  1. Start Lucee.
  2. Go into the “Services - Tasks” admin page, note the closed ID = 1 red task is still there.
  3. Create a new task thread.

The new task you created in step 9 will have ID = 1, just like the closed task does. If you click the detail button on either, you’ll see info from both on the same page, concatenated together. Not good.

This has got to be a bug, clearly the IDs should always be unique.

If you don’t stop/restart Lucee, this doesn’t happen. I suspect Lucee keeps track of the “next available ID” while it’s running, but forgets this value when it’s shutdown, and upon next start, I suspect Lucee checks all the OPEN tasks and selects the first free number, when instead it SHOULD be checking ALL tasks (both open and closed) and selecting the first free number (which, in this example, would result in a correct ID of 2).

I want to use task threads in my projects as they have a lot of potential, but this sort of big bug makes me think twice about using them heavily.

Hope this info helps it get fixed (if it’s not fixed already)! If anyone has any info related to this, please share in this thread, thanks!

8 days, 0 replies. Maybe I was too wordy above. Let’s try a TL/DR:

Lucee re-uses closed task ID numbers after a restart, and it shouldn’t. Delete all tasks (on the admin’s “Services - Tasks” page). Restart Lucee. Make a task, cause it to become closed. Restart Lucee. Make another task. Both have ID = 1. Click detail for either, you see detail for both. NOT GOOD, needs fix.

There, maybe that’ll help and someone will actually reply.

@ToroMaduro Yeah issue in lucee latest version also. Can you file a bug here ?https://luceeserver.atlassian.net

Thanks cfmitrah. Bug LDEV-3702 created, URL is:

https://luceeserver.atlassian.net/browse/LDEV-3702

2 Likes