prometheus / prometheus/client_python

Error: TypeError: expected str, bytes or os.PathLike object, not NoneType

Open
#1,061 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.4k
Forks
876
Avg merge
8d 4h
Merged PRs (30d)
1

Description

Sometimes i get this error:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.10/3.10.15/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/homebrew/Cellar/python@3.10/3.10.15/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/django_q/cluster.py", line 165, in __init__
    self.start()
  File "/opt/homebrew/lib/python3.10/site-packages/django_q/cluster.py", line 174, in start
    self.guard()
  File "/opt/homebrew/lib/python3.10/site-packages/django_q/cluster.py", line 315, in guard
    self.reincarnate(p)
  File "/opt/homebrew/lib/python3.10/site-packages/django_q/cluster.py", line 234, in reincarnate
    prometheus_multiprocess.mark_process_dead(process.pid)
  File "/opt/homebrew/lib/python3.10/site-packages/prometheus_client/multiprocess.py", line 169, in mark_process_dead
    for f in glob.glob(os.path.join(path, f'gauge_{mode}_{pid}.db')):
  File "/opt/homebrew/Cellar/python@3.10/3.10.15/Frameworks/Python.framework/Versions/3.10/lib/python3.10/posixpath.py", line 76, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

It happen here:

https://github.com/django-q2/django-q2/blob/337a5782d9113a6e9d058743488e7517aebb8280/django_q/cluster.py#L233-L234

When mark_process_dead is called.

Can you help me?

Thanks.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at django_q/cluster.py around lines 233-234 and trace the call into prometheus_client.multiprocess.mark_process_dead. Reproduce the failure and inspect why the path passed to os.path.join is None. Done means the cause is confirmed and the failing scenario has defined, verified behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, prometheus, python
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.