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

/processes returns 401 #36

Closed
LouisKottmann opened this issue Nov 5, 2014 · 10 comments
Closed

/processes returns 401 #36

LouisKottmann opened this issue Nov 5, 2014 · 10 comments

Comments

@LouisKottmann
Copy link

Hello,

Whenever I try to access the "/processes" page, I get an error:

$ sudo psdash -d
/usr/lib/python2.7/dist-packages/pkg_resources.py:1031: UserWarning: /home/baboon/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
  warnings.warn(msg, UserWarning)
INFO | psdash.run | Starting psdash v0.6.0
INFO | psdash.run | Listening on 0.0.0.0:5000
INFO | psdash.run | Starting web server
DEBUG | psdash.run | Updating net io counters...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gevent-1.0.1-py2.7-linux-x86_64.egg/gevent/pywsgi.py", line 508, in handle_one_response
    self.run_application()
  File "/usr/local/lib/python2.7/dist-packages/gevent-1.0.1-py2.7-linux-x86_64.egg/gevent/pywsgi.py", line 494, in run_application
    self.result = self.application(self.environ, self.start_response)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.7/dist-packages/Flask-0.10.1-py2.7.egg/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python2.7/dist-packages/psdash-0.6.0-py2.7.egg/psdash/web.py", line 134, in processes
    procs = current_service.get_process_list()
  File "/usr/local/lib/python2.7/dist-packages/psdash-0.6.0-py2.7.egg/psdash/node.py", line 164, in get_process_list
    'user': p.username(),
  File "build/bdist.linux-x86_64/egg/psutil/__init__.py", line 566, in username
    return pwd.getpwuid(self.uids().real).pw_name
KeyError: 'getpwuid(): uid not found: 999'
{'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.5',
 'HTTP_AUTHORIZATION': 'Basic YmFib29uOmNyb2M=',
 'HTTP_CACHE_CONTROL': 'no-cache',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_COOKIE': 'session=eyJjbGllbnRfaWQiOnsiIHUiOiJjZjUxMWIwNmJiYTA0ZDI0YWIwOWU0OWIyM2Y1MjE2YSJ9fQ.Bzr6pg.kDDse_FIZTonFBCicxeuiDSjo80',
 'HTTP_HOST': '192.168.1.16:5000',
 'HTTP_PRAGMA': 'no-cache',
 'HTTP_REFERER': 'http://192.168.1.16:5000/',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:34.0) Gecko/20100101 Firefox/34.0',
 'PATH_INFO': '/processes',
 'QUERY_STRING': 'node=localhost',
 'REMOTE_ADDR': '192.168.1.3',
 'REMOTE_PORT': '33640',
 'REQUEST_METHOD': 'GET',
 'SCRIPT_NAME': '',
 'SERVER_NAME': 'lilith',
 'SERVER_PORT': '5000',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'gevent/1.0 Python/2.7',
 'werkzeug.request': <Request 'http://192.168.1.16:5000/processes?node=localhost' [GET]>,
 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7f58fdced1e0>,
 'wsgi.input': <gevent.pywsgi.Input object at 0x7f58f71d1d50>,
 'wsgi.multiprocess': False,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)} failed with KeyError

192.168.1.3 - - [2014-11-05 01:05:14] "GET /processes?node=localhost HTTP/1.1" 500 161 0.020687
DEBUG | psdash.run | Updating net io counters...
DEBUG | psdash.run | Updating net io counters...

any ideas?

Regards,
LK

@Jahaja
Copy link
Owner

Jahaja commented Nov 5, 2014

Hi Loius,
Looks like the issue is caused by psutil. What version of psutil are you using?
You can see it using pip freeze.

It could also be worth installing psdash in a virtualenv to see if the issue still exists in a more isolated python environment.

@LouisKottmann
Copy link
Author

I had installed psdash from source, so I reinstalled with pip and then ran:

$ pip freeze psdash | grep psutil
psutil==2.1.1

It still doesn't work, I'll go learn about virtualenv

@LouisKottmann
Copy link
Author

Still no luck with virtualenv..

I think the following error is more likely to be the culprit:

KeyError: 'getpwuid(): uid not found: 999'

@Jahaja
Copy link
Owner

Jahaja commented Nov 5, 2014

Yeah, the underlying problem is most likely that you have process running with user id 999 that can't be found/resolved on your system. psutil should probably handle it better though.

@LouisKottmann
Copy link
Author

mmmmh these processes are docker-related, maybe psutil crashes when containers are present, I'll let them know.

@Jahaja
Copy link
Owner

Jahaja commented Nov 5, 2014

I'll commit a fix for this in psdash.

@Jahaja
Copy link
Owner

Jahaja commented Nov 9, 2014

Fixed by f20fa76.

@Jahaja Jahaja closed this as completed Nov 9, 2014
@LouisKottmann
Copy link
Author

works like a charm, thanks!

@giampaolo
Copy link

This has also been fixed in psutil: giampaolo/psutil#547

@Jahaja
Copy link
Owner

Jahaja commented Nov 26, 2014

@giampaolo Cool, thanks!

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

No branches or pull requests

3 participants