Archived

This forum has been archived. Please start a new discussion on GitHub.

Bug with concurrently dispatch methods

Platform: Windows 7
Ice Version: 3.5.0
IDE: VS 2012
Programming Language: C#

Actually, I'm not sure whether this is a bug or not.

I have written a simple service that has only one method called sayHello.It has a parameter delaySeconds which indicates how long it will block the thread in second.I have set the property Ice.ThreadPool.Server.SizeMax to 5 when start the service.

Then I wrote a MockClient project to simulate many clients visiting the service concurrently.In the MockClient,I have initialzied 50 clients in advance. Each client has own communicator and thread.

Most of the time,the service can concurrently dispatch the requests,but sometimes it only uses one thread to dispatch the requests.
Attachment not found.

After debugging with Ice source code,I found the problem is in the method execute which is in ThreadPool.cs.
if(_workItems.Count == 0)
{
    _m.Notify();
}
_workItems.Enqueue(workItem);
If the requests are so fast that the first notified thread in ThreadPool is not able to handle this workItem(_workItems.Dequeue()),the following requests will be queued in the first notified thread and no more other threads will be awaken cause _workItems.Count > 0.

I'm not sure about my understanding,maybe I just misunderstand your code.

The attachment is my test projects.

Attachment not found.

Comments

  • mes
    mes California
    Thanks Alex, we'll take a look at this.

    Mark