Skip to content

UnicodeDecodeError at ProcessCollector.collect() #234

@bnopne

Description

@bnopne

Hi, i get the following error when i try to run my app with Gunicorn:

Failed to read config file: gunicornconfig.py
Traceback (most recent call last):
  File "/home/vasilek/coller_app/env/lib/python3.6/site-packages/gunicorn/app/base.py", line 93, in get_config_from_filename
    execfile_(filename, cfg, cfg)
  File "/home/vasilek/coller_app/env/lib/python3.6/site-packages/gunicorn/_compat.py", line 72, in execfile_
    return six.exec_(code, *args)
  File "gunicornconfig.py", line 1, in <module>
    from prometheus_client import multiprocess
  File "/home/vasilek/coller_app/env/lib/python3.6/site-packages/prometheus_client/__init__.py", line 5, in <module>
    from . import process_collector
  File "/home/vasilek/coller_app/env/lib/python3.6/site-packages/prometheus_client/process_collector.py", line 93, in <module>
    PROCESS_COLLECTOR = ProcessCollector()
  File "/home/vasilek/coller_app/env/lib/python3.6/site-packages/prometheus_client/process_collector.py", line 39, in __init__
    registry.register(self)
  File "/home/vasilek/coller_app/env/lib/python3.6/site-packages/prometheus_client/core.py", line 50, in register
    names = self._get_names(collector)
  File "/home/vasilek/coller_app/env/lib/python3.6/site-packages/prometheus_client/core.py", line 86, in _get_names
    for metric in desc_func():
  File "/home/vasilek/coller_app/env/lib/python3.6/site-packages/prometheus_client/process_collector.py", line 56, in collect
    parts = (stat.read().split(')')[-1].split())
  File "/home/vasilek/.pyenv/versions/3.6.4/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 21: invalid continuation byte

App is started with command: gunicorn -b 0.0.0.0 app:api --config gunicornconfig.py --workers=4 --log-level=DEBUG --worker-class=aiohttp.worker.GunicornWebWorker --reload

Contents of gunicornconfig.py are taken straight from multiprocessing tutorial for this module:

from prometheus_client import multiprocess


def child_exit(server, worker):
    multiprocess.mark_process_dead(worker.pid)

Other packages:

python 3.6.4
gunicorn 19.7.1
prometheus-client 0.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions