prometheus / prometheus/client_python
Multiprocess application sometimes throwing UnicodeDecodeError in prometheus_client/mmap_dict.py
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 876
- Avg merge
- 8d 4h
- Merged PRs (30d)
- 1
Description
Hi
I have multiprocess enabled application with flask exporter, sometimes it is throwing below error
File "usr/local/lib/python3.8/site-packages/prometheus_client/mmap_dict.py", line 44, in _read_all_values
yield encoded_key.decode('utf-8'), value, pos
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 18: invalid continuation byte.
After this error my application is crashed. Can someone please help me on this?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in prometheus_client/mmap_dict.py at _read_all_values and inspect how multiprocess mmap data reaches encoded_key.decode('utf-8'). Reproduce the failure with a multiprocess application using the Flask exporter, then verify that the resulting UnicodeDecodeError no longer crashes the application.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- prometheus, python
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100