5


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.

  • 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 Mar 19 '11 at 12:26
  • @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. –  Mar 19 '11 at 12:29
  • 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](http://technet.microsoft.com/en-us/sysinternals/bb896653) to see which threads are active. – Jeroen Wiert Pluimers Mar 19 '11 at 12:54
  • @Chris I cannot make the service I'm using public, however I'm able to replicate the "hanging issue" using this service http://greg.froh.ca/fun/random_bushism/soap/index.php?wsdl I've imported it using "Auto SOAP versioning" –  Mar 19 '11 at 13:16
  • 1
    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 Mar 19 '11 at 14:27
  • @Chris I have a test app. besides the project -- this test app. does NOT use threads for requests and still after the response is received, the app. has threads "floating" for a reasons which I'm trying to find... –  Mar 19 '11 at 14:33
  • @Dorin. Right so you should provide the test app as an example, so others can examine it directly rather than via telepathy. – Chris Thornton Mar 19 '11 at 15:31
  • @Chris I've uploaded a test application http://www.2shared.com/file/_dE4H-lO/soap_test_app.html –  Mar 19 '11 at 15:43
  • 1
    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 Mar 21 '11 at 09:54

1 Answers1

1

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).

ethrbunny
  • 10,379
  • 9
  • 69
  • 131
  • the number of threads(after second call) increases and decreases by 2 for each request, about memory leaking: I'm not sure yet if it leaks, I'll know in a day or two. –  Mar 21 '11 at 22:36
  • use 'perfmon' to find out if its leaking anything – ethrbunny Mar 22 '11 at 20:07
  • can you provide a link please? –  Mar 24 '11 at 09:10
  • 'perfmon' is a windows app. Just 'start' 'run' 'perfmon' - look about for different things to monitor - by process, system, etc. – ethrbunny Mar 28 '11 at 16:39
  • ohhh my bad, I thought you were referring to a third party expert/addon which can help in finding memory leaks –  Mar 29 '11 at 03:38