I think that there is a bug in Poco::TaskManager::start that causes _taskList to contain a task that isn't running... more correctly, it never started. The code was pushing the task onto _taskList before it was started in the thread pool. If the pool couldn't allocate the thread due to its configuration (maxThreads) or some other failure, then it will throw an exception and the Task object stays on the _taskList. Since the task never starts, it follows that it never finishes cleanly either. The only place that a Task object is ever removed from _taskList is in the taskFinished callback so any Task object that cannot be run on a thread is stranded on _taskList.
The patch is pretty simple - just add a try-catch block and pop _taskList if an exception is thrown:
--- src/TaskManager.cpp (revision 391)
+++ src/TaskManager.cpp (working copy)
@@ -64,12 +64,24 @@
void TaskManager::start(Task* pTask)
+ TaskPtr pAutoTask(pTask); // take ownership immediately
Should I commit this to trunk or create a copy in sandbox and commit it? I also added a new test case to TaskManagerTest.cpp to verify the fix.