-
Notifications
You must be signed in to change notification settings - Fork 181
Description
Hi,
I found an issue in using groups and I would like to check if it is known issue or not.
steps to reproduce:
- Start a ThreadPool with a WorkGroup - set MinThreads = 0, MaxThreads =1, IdleTimeout = 60 seconds
- Send a task to WorkItemGroup every 60 seconds
- after some time, tasks stop to process
Here is what happens:
Thread#1 [STP Worker thread] timeouts, because it has empty queue for 60 seconds and starts terminating (there's still some work to do after the timeout check and before the thread is freed)
In meantime
Thread#2 [new thread] enqueues a task to the WorkItemGroup,
Thread#2 WorkItemGroup enqueues a task to SmartThreadPool expecting that STP withdraw the task,
Thread#2 STP enqueues a task and doesn't start a thread, because there's one already running (it doesn't know that it's terminating)
Thread#1 [STP Worker thread] finishes termination and removes itself from STP
Thread#3 [new thread] [Receiver] enqueues a task to Work Items Group
Thread#3 WorkItemGroup doesn't do anything, because it thinks that STP has already enough tasks in queue
since then the STP has no running thread and all new tasks are enqueued to the WorkItemGroup and the queue is growing and never processed