Author | Forum: PowerSNMP for .NET Topic: Manager.Start blocking on SetMessage |
tgrharris aharris@harris.com From: Palm Bay, FL USA Posts: 25 Member Since: 06/22/09 |
posted February 23, 2011 9:02 AM I have an application that has multiple objects that contain individual Manager objects. Each one of these objects has a worker thread running through the object to perform status polling and provides capabilities for clients to set values on agents. When I can communicate with agents everything works fine. If some of the agents I am polling start to time out in polling for status, I notice that SetMessage requests are having to wait for the status polling timeouts to complete before the SetMessage delegate method gets invoked. So here is a snippet of code: This code does a series of GetMessage requests. It doesn't seem to block for agents that are communicating even if other agents are nto communicating. Mgr.Start(StatusRequest, variables); private void StatusRequest(ManagerSlave slave, object state) { ... ResponseMessage response = slave.GetResponse(request, Item.IPAddress, (int)Item.TransmitPort); ... } This code is used when a value is being set. It seems to hang waiting on timeouts from the StatusRequest delegate call. Mgr.Start(SetRequest, variables); private void SetRequest(ManagerSlave slave, object variables) { ... SetMessage request = new SetMessage(); ResponseMessage response = slave.GetResponse(request, Item.IPAddress, (int) Item.TransmitPort); ... } The GetResponse in the case of the SetMessage seems to hang based on other Manager objects timing out while the GetResponse of GetMessage is not affected. My question is even though I have multiple objects each running in their own thread and each with unique Manager objects, is the framework somehow funneling all set requests throu |
tgrharris aharris@harris.com From: Palm Bay, FL USA Posts: 25 Member Since: 06/22/09 |
posted February 23, 2011 9:37 AM Minor correction. The GetResponse doesn't hang. The time between the Mgr.Start(SetRequest, variables) and the invocation of the delegate method (SetRequest in this case) is where the blocking seems to occur. Once I get the delegate invoked and am inside the SetRequest method, things work as expected. It's just the time between the Start and invocation of the Start method seems to be blocked by timeouts from other Manager threads within the same application space. |
Mike Baldwin (Admin)![]() From: Rome, NY USA Posts: 114 Member Since: 04/11/00 Extra Support Options Custom Application Development |
posted February 23, 2011 12:11 PM Hi TGR, I'm guessing you are using all the threads in your thread pool, and your new worker threads can't start up until a thread is returned to the thread pool. Please try increasing the size of your thread pool and let us know how that works out. Thank you for using PowerSNMP! |
tgrharris aharris@harris.com From: Palm Bay, FL USA Posts: 25 Member Since: 06/22/09 |
posted February 23, 2011 3:31 PM I instrumented the code to print out the number of available worker threads (System.Threading.ThreadPool.GetAvailableThreads). I start out at 1013 and dip to around 950 and then hover in the 970 free thread range. I wasn't sure how the internal Manager code allocates threads. There isn't kind of thread pooling between instances of a Manager object is there? I have 40 Manager instances in a single process and it seems like there is some dependency between them. Are they all registering for SNMP responses and are some of the Manager instances seeing the timeouts from the other Manager instances? |
Mike Baldwin (Admin)![]() From: Rome, NY USA Posts: 114 Member Since: 04/11/00 Extra Support Options Custom Application Development |
posted February 23, 2011 8:33 PM All the manager threads are independent of each other, and go into a wait state using a blocking socket receive when waiting for the SNMP agent to respond to it's request. If you are running a forms application that is marshaling data back to the UI thread there could be some contention there. ThreadPool.QueueWorkItem is used to start each worker thread, so look there to see what conditions might cause what you're seeing. |
Reply | PowerSNMP for .NET Topics | Forums |
This site is powered by
![]() |