5
votes


when I make a SOAP request I can see(in task manager) that my application's number of threads increases from 1(the main thread) to 8, this means 7 additional threads, this part is OK, however after the response is received from the service, the number of threads decreases to 4(3 + main thread) and stays that way until the next request is made. Since I'm not to comfortable with SOAP and haven't worked with it too much, does anyone know if this is normal or if I can kill/stop the "hanging" threads?
Using Delphi 2010

Additional info: I'm running the requests in a thread and yes I call "CoInitialize" and "CoUninitialize" in the Execute method.

Test application: http://www.2shared.com/file/_dE4H-lO/soap_test_app.html

Thank you all for your time.

1
Are you creating any threads in your app? The reason that I ask, is that it's very useful to run SOAP requests in a thread, so it won't block your main app.Chris Thornton
@Chris sorry I forgot to mention this for some odd reason, YES I'm running the requests in a thread and I'm creating objects dynamically and freeing them.user497849
Can you provide a little bit of example code? That way we can try to reproduce your case and see which treads are being kept active. BTW: You can use Process Explorer to see which threads are active.Jeroen Wiert Pluimers
So as a baseline, if you were to make a very basic soap project, with no extra threads... just have a main form with a GO button and a status label. When you click GO, it sends the SOAP request, and when that's done, it updates the label to "done". What do you observe with regard to the thread count as you progress from a) form open, b) click go, c) DONE received? This would help isolate the issue to something wonky with SOAP in general, vs something wonky with your code.Chris Thornton
I'd say it is quite common for "manager" threads, or responder threads, to be kept around. After all, you might want to do another SOAP call and it saves setup time. I'd look in the library source and see what it actually does. That will tell you what is happening exactly.mj2008

1 Answers

1
votes

Some other part of the app is refcounting something in the SOAP stack. Those threads won't go away until the rest of the clean up occurs.

What happens if you call the SOAP function repeatedly? Does it continue to grow by 3 each time or does it settle down? If it continues to grow you have something to do. If not, its a low-level function and (probably) not your problem. Keep an eye on memory and see if its leaking over time (esp when you hammer on it).