Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PermissionError on macOS #1120

Closed
MichaelMa2014 opened this issue Jul 4, 2017 · 6 comments
Closed

PermissionError on macOS #1120

MichaelMa2014 opened this issue Jul 4, 2017 · 6 comments

Comments

@MichaelMa2014
Copy link

Description

After running for a while, glances will crash on a PermissionError. This is different from issue #885 because it does not crash immediately when starting.

Versions

  • Glances (glances -V): Glances v2.10
  • PSutil (glances -V): psutil v5.2.2
  • Operating System (lsb_release -a): macOS Sierra 10.12.5 (16F73)

Logs

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/bin/glances", line 11, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glances/__init__.py", line 134, in main
    start(config=config, args=args)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glances/__init__.py", line 103, in start
    mode.serve_forever()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glances/standalone.py", line 117, in serve_forever
    self.schedule.run()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/sched.py", line 147, in run
    action(*argument, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glances/standalone.py", line 100, in __serve_forever
    self.stats.update()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glances/stats.py", line 192, in update
    self._plugins[p].update()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glances/plugins/glances_processcount.py", line 57, in update
    glances_processes.update()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glances/processes.py", line 428, in update
    standard_stats=self.max_processes is None)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glances/processes.py", line 387, in __get_process_stats
    procstat = self.__get_mandatory_stats(proc, procstat)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/glances/processes.py", line 242, in __get_mandatory_stats
    ad_value=''))
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/psutil/__init__.py", line 563, in as_dict
    ret = meth()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/psutil/_common.py", line 318, in wrapper
    ret = cache[fun] = fun(self)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/psutil/__init__.py", line 1097, in cpu_times
    return self._proc.cpu_times()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/psutil/_psosx.py", line 293, in wrapper
    return fun(self, *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/psutil/_psosx.py", line 416, in cpu_times
    rawtuple = self._get_pidtaskinfo()
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/psutil/_common.py", line 318, in wrapper
    ret = cache[fun] = fun(self)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/psutil/_psosx.py", line 331, in _get_pidtaskinfo
    ret = cext.proc_pidtaskinfo_oneshot(self.pid)
PermissionError: [Errno 1] Operation not permitted
@nicolargo
Copy link
Owner

@giampaolo: what do you think ?

@rozenstein94
Copy link

rozenstein94 commented Jul 7, 2017

I found a workaround. you need to install brew version of python to have no problems. But at the same time most pip packages are successfully installed under built-in python, and supporting unofficial version isn't right way. Also pip install glances --user works due to reports I found online. At least documentation needs to be updated, but its a workarounds

@giampaolo
Copy link

I remember I've seen a similar issue already. I am not sure why it happens but it's a psutil bug, because I would expect psutil.AccessDenied, not PermissionError.

@nicolargo
Copy link
Owner

@giampaolo Ok waiting for the PSUtil patch. I will add a psutil.AccessDenied catch on my side.

Thanks for the report.

nicolargo added a commit that referenced this issue Jul 8, 2017
@nicolargo
Copy link
Owner

Done in the DEVELOP branch.

PS: Need the PsUtil version correcting the issue.

@MichaelMa2014
Copy link
Author

Thanks a lot for the quick response. You guys are amazing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants