1

I have written a multi-threaded program in python that runs a total of 4 threads including the main. Threads are started at the beginning and there is no loop or anything surrounding their creation.

When I run the threading.enumerate() or some equivalent, python reports 5 threads including my 4 plus a daemon, and this doesn't change over time (steady state).

however, widows Resource Monitor shows over 400 threads attributed to the python.exe process, and it's constantly rising (increases 4, decreases 2, and so on).

I guess it might be hard to help me without the code, and the code would be too lengthy for the community to analyse, but are there any specific common things in python that tend to cause this ? Would it be possible that the Resource Monitors sees some dead threads that gets run and terminated but not collected ?

Also, in general, what can make the number of threads output by len(threading.enumerate()) and the windows Resource Monitor so different ? Why is python not seeing these 350 ++ threads that windows is counting ?

Note that my program continuously opens and terminates subprocesses (using Popen and calling terminate() after its done), if that could lead to something...

user3829017
  • 11
  • 1
  • 3
  • Run Sysinternals Process Explorer. Double click on the python.exe process and check the "Threads" tab. – Eryk Sun Oct 04 '16 at 21:49
  • This issue have been solved by running the Process Explorer. My company's security software was running multiple threads and that was what caused this. I solved the problem by renaming their .dll file to some funny name. PS dont tell my boss. – user3829017 Oct 07 '16 at 17:46

0 Answers0