Any2HRTF / Mesh2HRTF

Open software for the numerical calculation of head-related transfer functions
European Union Public License 1.2
111 stars 14 forks source link

known issue: manage_numcalc_script.py freeze and high CPU usage #50

Open SDX-LV opened 2 years ago

SDX-LV commented 2 years ago

On one of the 2 tested Win10 computers manage_numcalc_script.py is dead-slow - unusable.

I traced the issue to the _numcalc_instances() function in manage_numcalc.py. Specifically on that Windows computer the for p in psutil.process_iter(['name', 'memory_info']): takes about 2,5 minutes to execute and fully loads one CPU core. As this command is called after each NumCalc Instance, it looks like the script is dead.

The issue could be caused by antivirus or some corporate software, but the

workaround in manage_numcalc.py is to change line: running_instances = _numcalc_instances() to running_instances = 7.777 # workaround _numcalc_instances()

This will skip the extremely slow _numcalc_instances() function and fix the performance. What is lost is the possibility to limit CPU core limit (max_instances), but the max_cpu_load is still available (even if it is not very effective).

If more people are affected, please report it here and then the issue may get a permanent fix.

f-brinkmann commented 2 years ago

That sounds nasty. Please report if you experience this on other machines as well. If this is the case, I would suggest to kill the process if it takes to long and raise a warning to inform the user. It seems as if subprocess can do this out of the box: https://medium.com/@chaoren/how-to-timeout-in-python-726002bf2291