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

'utf-8' codec can't decode byte 0xf8 in position 0 #130

Closed
debnet opened this issue Feb 17, 2020 · 5 comments · Fixed by #136
Closed

'utf-8' codec can't decode byte 0xf8 in position 0 #130

debnet opened this issue Feb 17, 2020 · 5 comments · Fixed by #136

Comments

@debnet
Copy link

debnet commented Feb 17, 2020

Since the installation of powa, I got error with pg_activity script whereas I'm using it for years without a single error.

(python) [marc@marcbook ~]$ pg_activity -U postgres
FATAL: 'utf-8' codec can't decode byte 0xf8 in position 0: invalid start byte
@julmon
Copy link
Contributor

julmon commented Feb 29, 2020

Could you try with --debug ?

@debnet
Copy link
Author

debnet commented Mar 2, 2020

Traceback (most recent call last):
  File "/usr/bin/pg_activity", line 310, in main
    procs, disp_procs)
  File "/usr/lib/python3.7/site-packages/pgactivity/UI.py", line 1166, in poll
    disp_proc)
  File "/usr/lib/python3.7/site-packages/pgactivity/UI.py", line 1295, in __poll_activities
    queries =  self.data.pg_get_activities()
  File "/usr/lib/python3.7/site-packages/pgactivity/Data.py", line 448, in pg_get_activities
    ret = cur.fetchall()
  File "/usr/lib64/python3.7/site-packages/psycopg2/extras.py", line 99, in fetchall
    res = super(DictCursorBase, self).fetchall()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf8 in position 0: invalid start byte
FATAL: 'utf-8' codec can't decode byte 0xf8 in position 0: invalid start byte

Seems the error come from psycopg2 but I was using pg_activity for years without error, I got this error since powa is installed on my local database.

blogh added a commit to blogh/pg_activity that referenced this issue Apr 9, 2020
* This commit attenpts to solve issue :  dalibo#130.
* PoWA has a bug where backend_type is not correctly filled. it
  was fixed but it's not in the stable version yet.
* Previously, we queried for the `backend_type` and filtered
  `parallel workers` in the Python code. The test is now done in
  SQL,  which avoids the problems all together.
* The `parallel worker` detection was not working for pg 11+ because
  it uses the 'parallel worker' backend_type. It's now fixed.
blogh added a commit to blogh/pg_activity that referenced this issue Apr 9, 2020
* This commit attenpts to solve issue : dalibo#130 [1].
* PoWA has a bug where backend_type is not correctly filled [2]. it
  was fixed but it's not in the stable version yet.
* Since [3], we queried for the `backend_type` and filtered
  `parallel workers` in the Python code. The test is now done in
  SQL,  which avoids the problems all together.
* The `parallel worker` detection was not working for pg 11+ because
  it uses the 'parallel worker' backend_type. It's now fixed.

[1] dalibo#130
[2] powa-team/powa-archivist#20
[3] dalibo@6a180d8
blogh added a commit to blogh/pg_activity that referenced this issue Apr 9, 2020
* This commit attempts to solve the issue : dalibo#130 [1].
* PoWA has a bug where `backend_type` is not correctly filled [2]. it
  was fixed but it's not in the stable version yet.
* Since [3], we queried for the `backend_type` and filtered
  `parallel workers` in the Python code. The test is now done in
  SQL,  which avoids the problems all together.
* The `parallel worker` detection was not working for pg 11+ because
  it uses the 'parallel worker' backend_type. It's now fixed.

[1] dalibo#130
[2] powa-team/powa-archivist#20
[3] dalibo@6a180d8
@blogh
Copy link
Collaborator

blogh commented Apr 9, 2020

Hi,

The problem is related to this issue : powa-team/powa-archivist#20
The fix is not in the current stable version of PoWA.

The backend_type is wrong :

10.20.40.50:5432 powa@postgres=# SELECT application_name, backend_type FROM pg_stat_activity \gx
-[ RECORD 1 ]----+--------------------------------
application_name | PoWA collector
backend_type     | pm\x7F

Which triggers :

UnicodeDecodeError('utf-8',  b'pm\xa7\x95\xff\x7f', 2, 3, 'invalid start byte')

The PR attempts to fix this.

Benoit.

@blogh
Copy link
Collaborator

blogh commented Apr 10, 2020

The PR was merged, can you try it ?

@blogh
Copy link
Collaborator

blogh commented May 6, 2020

Fixed

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

Successfully merging a pull request may close this issue.

3 participants