Title
#windows
e

ehrhardt

02/19/2020, 10:11 PM
Found an open issue for the same problem with profiler.py on windows. Any idea when this is expected to be updated? https://github.com/osquery/osquery/issues/5560
a

Andrea

02/20/2020, 3:59 PM
I don't know if you are a developer at all, but the issue you are pointing out is quite an easy fix. on
tools/test/utils.py
you can substitute the string
"fds": p.num_fds(),
with
"fds": p.num_fds() if platform() == "linux" else -1,
on
get_stats
function. If I remember correctly that's all you need to do.
s

seph

02/20/2020, 8:59 PM
PRs welcome 🙂
e

ehrhardt

02/20/2020, 10:53 PM
I tried simply setting "fds" to null which I think would effectively be the same and more errors are generated
10:55 PM
now it is
_pswindows.py", line 957, in cpu_times
    user, system = cext.proc_cpu_times(self.pid)
ProcessLookupError: [Errno 3] No such process
10:56 PM
Traceback (most recent call last):
  File "osquery-master\tools\analysis\profile.py", line 358, in <module>
    timeout=args.timeout, count=args.count, rounds=args.rounds
  File "osquery-master\tools\analysis\profile.py", line 194, in profile
    result = run_query(shell, query, timeout=timeout, count=count)
  File "osquery-master\tools\analysis\profile.py", line 137, in run_query
    ], timeout=timeout, count=count)
  File "C:\Program Files\osquery\osquery-master\tools\analysis/../tests\utils.py", line 159, in profile_cmd
    current_stats = get_stats(p, step)
  File "C:\Program Files\osquery\osquery-master\tools\analysis/../tests\utils.py", line 131, in get_stats
    utilization = p.cpu_percent(interval=interval)
  File "C:\Users\ehrhardt\AppData\Local\Programs\Python\Python37-32\lib\site-packages\psutil\__init__.py", line 1106, in cpu_percent
    pt2 = self._proc.cpu_times()
  File "C:\Users\ehrhardt\AppData\Local\Programs\Python\Python37-32\lib\site-packages\psutil\_pswindows.py", line 718, in wrapper
    raise convert_oserror(err, pid=self.pid, name=self._name)
psutil.NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=4152)
a

Andrea

02/21/2020, 10:52 AM
That is exactly where I am with
profile.py
on Windows 😄 On Linux works fine. Not sure if it is
psutil
or
osquery
.
10:54 AM
Basically it seems that
osqueryi
's process dies while still doing some work and
psutil
clearly gets angry.