[GH-ISSUE #87] Error 500 with proxmox 7 - JSON response into exception #45

Closed
opened 2026-02-27 15:46:09 +03:00 by kerem · 11 comments
Owner

Originally created by @samyscoub on GitHub (Feb 7, 2022).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/87

Originally assigned to: @jhollowe on GitHub.

With proxmox 7 my previous working code on proxmox 6 doesn't work anymore.

Problem is also present with python3

Distribution is Debian 11 ( proxmox 7 : pve-manager/7.1-10/6ddebafe (running kernel: 5.13.19-3-pve) )
Proxmoxer 1.2.0 release

 for node in proxmox.nodes.get():
  File "XXXX/venv-python2.7/lib/python2.7/site-packages/proxmoxer/core.py", line 123, in get
    return self(args)._request("GET", params=params)
  File "XXXX//venv-python2.7/lib/python2.7/site-packages/proxmoxer/core.py", line 117, in _request
    resp.text
proxmoxer.core.ResourceException: 500 Internal Server Error: [{"cpu":0.152678048010119,"disk":340515770368,"id":" ...... 
 .."type":"node","uptime":518181}]

Json Response seems to be good but printed as Exception.

What's the problem with Proxmox 7 ?

Originally created by @samyscoub on GitHub (Feb 7, 2022). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/87 Originally assigned to: @jhollowe on GitHub. With proxmox 7 my previous working code on proxmox 6 doesn't work anymore. Problem is also present with python3 Distribution is Debian 11 ( proxmox 7 : pve-manager/7.1-10/6ddebafe (running kernel: 5.13.19-3-pve) ) Proxmoxer 1.2.0 release ``` for node in proxmox.nodes.get(): File "XXXX/venv-python2.7/lib/python2.7/site-packages/proxmoxer/core.py", line 123, in get return self(args)._request("GET", params=params) File "XXXX//venv-python2.7/lib/python2.7/site-packages/proxmoxer/core.py", line 117, in _request resp.text proxmoxer.core.ResourceException: 500 Internal Server Error: [{"cpu":0.152678048010119,"disk":340515770368,"id":" ...... .."type":"node","uptime":518181}] ``` Json Response seems to be good but printed as Exception. What's the problem with Proxmox 7 ?
Author
Owner

@jhollowe commented on GitHub (Feb 17, 2022):

Can we get a full code example (of course with credentials redacted) so we can see the whole picture?

When I try running the for loop seen above, it works.

Python 3.9.10 (main, Jan 18 2022, 21:15:42) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from proxmoxer import ProxmoxAPI
>>> 
>>> proxmox = ProxmoxAPI("1.2.3.4", user="root@pam", password="password", verify_ssl=False)
>>> proxmox.version.get()
{'release': '7.1', 'repoid': '6ddebafe', 'version': '7.1-10'}
>>> for node in proxmox.nodes.get():
...     print(node)
... 
{'node': 'node-name-here', 'disk': 5819858944 <rest of object info>}
<object for other node>
<!-- gh-comment-id:1042510897 --> @jhollowe commented on GitHub (Feb 17, 2022): Can we get a full code example (of course with credentials redacted) so we can see the whole picture? When I try running the for loop seen above, it works. ```text Python 3.9.10 (main, Jan 18 2022, 21:15:42) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from proxmoxer import ProxmoxAPI >>> >>> proxmox = ProxmoxAPI("1.2.3.4", user="root@pam", password="password", verify_ssl=False) >>> proxmox.version.get() {'release': '7.1', 'repoid': '6ddebafe', 'version': '7.1-10'} >>> for node in proxmox.nodes.get(): ... print(node) ... {'node': 'node-name-here', 'disk': 5819858944 <rest of object info>} <object for other node> ```
Author
Owner

@samyscoub commented on GitHub (Feb 19, 2022):

@jhollowe : here is my code :

>>> from proxmoxer import ProxmoxAPI
>>> proxmox = ProxmoxAPI('localhost', user='root', backend='ssh_paramiko')
>>> for vm in proxmox.cluster.resources.get(type='vm'):
...   print("{0}/{1} {2} => {3} on {4}" .format(vm['type'], vm['vmid'], vm['name'], vm['status'], vm['node']))
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/proxmoxer/core.py", line 84, in get
    return self(args)._request("GET", params=params)
  File "/usr/lib/python3/dist-packages/proxmoxer/core.py", line 78, in _request
    raise ResourceException("{0} {1}: {2}".format(resp.status_code, httplib.responses[resp.status_code],
proxmoxer.core.ResourceException: 500 Internal Server Error: ┌──────────┬──────┬─────────┬───────┬───────────┬─────────┬───────┬────────┬───────────┬─────────
─┬────────────┬──────────────────────────────┬────────────────┬────────────┬──────┬─────────┬─────────┬───────────────────┐
│ id       │ type │ content │   cpu │ disk      │ hastate │ level │ maxcpu │   maxdisk │   maxmem │ mem        │ name                         │ node
 │ plugintype │ pool │ status  │ storage │            uptime │
╞══════════╪══════╪═════════╪═══════╪═══════════╪═════════╪═══════╪════════╪═══════════╪══════════╪════════════╪══════════════════════════════╪═══════════════
═╪════════════╪══════╪═════════╪═════════╪═══════════════════╡
│ lxc/100  │ lxc  │         │ 1.00% │ 4.31 GiB  │ started │       │      2 │ 19.56 GiB │ 2.00 GiB │ 827.83 MiB.  
.......
 │            │      │ stopped │         │                0s │
└──────────┴──────┴─────────┴───────┴───────────┴─────────┴───────┴────────┴───────────┴──────────┴────────────┴──────────────────────────────┴───────────────
─┴────────────┴──────┴─────────┴─────────┴───────────────────┘ 
<!-- gh-comment-id:1046082190 --> @samyscoub commented on GitHub (Feb 19, 2022): @jhollowe : here is my code : ``` >>> from proxmoxer import ProxmoxAPI >>> proxmox = ProxmoxAPI('localhost', user='root', backend='ssh_paramiko') >>> for vm in proxmox.cluster.resources.get(type='vm'): ... print("{0}/{1} {2} => {3} on {4}" .format(vm['type'], vm['vmid'], vm['name'], vm['status'], vm['node'])) ... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3/dist-packages/proxmoxer/core.py", line 84, in get return self(args)._request("GET", params=params) File "/usr/lib/python3/dist-packages/proxmoxer/core.py", line 78, in _request raise ResourceException("{0} {1}: {2}".format(resp.status_code, httplib.responses[resp.status_code], proxmoxer.core.ResourceException: 500 Internal Server Error: ┌──────────┬──────┬─────────┬───────┬───────────┬─────────┬───────┬────────┬───────────┬───────── ─┬────────────┬──────────────────────────────┬────────────────┬────────────┬──────┬─────────┬─────────┬───────────────────┐ │ id │ type │ content │ cpu │ disk │ hastate │ level │ maxcpu │ maxdisk │ maxmem │ mem │ name │ node │ plugintype │ pool │ status │ storage │ uptime │ ╞══════════╪══════╪═════════╪═══════╪═══════════╪═════════╪═══════╪════════╪═══════════╪══════════╪════════════╪══════════════════════════════╪═══════════════ ═╪════════════╪══════╪═════════╪═════════╪═══════════════════╡ │ lxc/100 │ lxc │ │ 1.00% │ 4.31 GiB │ started │ │ 2 │ 19.56 GiB │ 2.00 GiB │ 827.83 MiB. ....... │ │ │ stopped │ │ 0s │ └──────────┴──────┴─────────┴───────┴───────────┴─────────┴───────┴────────┴───────────┴──────────┴────────────┴──────────────────────────────┴─────────────── ─┴────────────┴──────┴─────────┴─────────┴───────────────────┘ ```
Author
Owner

@jhollowe commented on GitHub (Feb 20, 2022):

Using your code above (except with my PVE's IP and specifying a private_key_file), the same PVE version, python 3.9.10, and paramiko 2.9.2 I get the list of VMs and containers printed successfully (from both nodes in my cluster).

What version of python and paramiko are you using? You can get this information from python --version and pip freeze.

I would suggest trying to run the commands against one of the other nodes in your cluster to see if it responds correctly. You can also directly run pvesh get /cluster/resources -type 'vm' --output-format json on the node you are connecting to and make sure the output is correct and the exit code is 0.
If you are still having problems, reply with what steps you took and what the results were and we can continue troubleshooting this.

<!-- gh-comment-id:1046308503 --> @jhollowe commented on GitHub (Feb 20, 2022): Using your code above (except with my PVE's IP and specifying a private_key_file), the same PVE version, python 3.9.10, and paramiko 2.9.2 I get the list of VMs and containers printed successfully (from both nodes in my cluster). What version of python and paramiko are you using? You can get this information from `python --version` and `pip freeze`. I would suggest trying to run the commands against one of the other nodes in your cluster to see if it responds correctly. You can also directly run `pvesh get /cluster/resources -type 'vm' --output-format json` on the node you are connecting to and make sure the output is correct and the exit code is 0. If you are still having problems, reply with what steps you took and what the results were and we can continue troubleshooting this.
Author
Owner

@samyscoub commented on GitHub (Feb 20, 2022):

This command return good result ( exit 0 ) :

pvesh get cluster/resources -type=vm --output-format=json

My versions :

$ python --version
Python 3.9.2
$ pip freeze
appdirs==1.4.4
bcrypt==3.1.7
beautifulsoup4==4.9.3
ceph==1.0.0
ceph-volume==1.0.0
cephfs==2.0.0
certifi==2020.6.20
cffi==1.15.0
chardet==4.0.0
CherryPy==8.9.1
crit==0.0.1
cryptography==3.3.2
cycler==0.10.0
dbus-python==1.2.16
distlib==0.3.1
distro-info==1.0
fail2ban==0.11.2
filelock==3.0.12
gpg===1.14.0-unknown
html5lib==1.1
httplib2==0.18.1
idna==2.10
importlib-metadata==1.6.0
invoke==1.4.1
iotop==0.6
isc==2.0
kiwisolver==1.3.1
loggers==0.1.4
logutils==0.3.3
lxml==4.6.3
Mako==1.1.3
MarkupSafe==1.1.1
matplotlib==3.3.4
more-itertools==4.2.0
numpy==1.19.5
olefile==0.46
openssh-wrapper==0.4
paramiko==2.7.2
Paste==3.5.0
PasteDeploy==2.1.1
PasteScript==2.0.2
pecan==1.3.3
Pillow==8.1.2
ply==3.11
prettytable==0.7.2
protobuf==3.12.4
proxmoxer==1.0.3
pycparser==2.21
pycurl==7.43.0.6
PyGObject==3.38.0
pyinotify==0.9.6
PyJWT==1.7.1
PyNaCl==1.5.0
pyOpenSSL==20.0.1
pyparsing==2.4.7
PySimpleSOAP==1.16.2
python-apt==2.2.1
python-dateutil==2.8.1
python-debian==0.1.39
python-debianbts==3.1.0
PyYAML==5.3.1
rados==2.0.0
rbd==2.0.0
reportbug==7.10.3+deb11u1
repoze.lru==0.7
requests==2.25.1
rgw==2.0.0
Routes==2.5.1
simplegeneric==0.8.1
simplejson==3.17.2
six==1.16.0
soupsieve==2.2.1
ssh-paramiko==0.1.2
systemd-python==234
Tempita==0.5.2
unattended-upgrades==0.1
urllib3==1.26.5
virtualenv==20.4.0+ds
waitress==1.4.4
webencodings==0.5.1
WebOb==1.8.6
WebTest==2.0.35
Werkzeug==1.0.1
zipp==1.0.0

I supposed that proxmox.cluster.resources.get(type='vm') return bad format ( array style instead of json style ) don't you know ?

<!-- gh-comment-id:1046324321 --> @samyscoub commented on GitHub (Feb 20, 2022): This command return good result ( exit 0 ) : ``` pvesh get cluster/resources -type=vm --output-format=json ```` My versions : ``` $ python --version Python 3.9.2 $ pip freeze appdirs==1.4.4 bcrypt==3.1.7 beautifulsoup4==4.9.3 ceph==1.0.0 ceph-volume==1.0.0 cephfs==2.0.0 certifi==2020.6.20 cffi==1.15.0 chardet==4.0.0 CherryPy==8.9.1 crit==0.0.1 cryptography==3.3.2 cycler==0.10.0 dbus-python==1.2.16 distlib==0.3.1 distro-info==1.0 fail2ban==0.11.2 filelock==3.0.12 gpg===1.14.0-unknown html5lib==1.1 httplib2==0.18.1 idna==2.10 importlib-metadata==1.6.0 invoke==1.4.1 iotop==0.6 isc==2.0 kiwisolver==1.3.1 loggers==0.1.4 logutils==0.3.3 lxml==4.6.3 Mako==1.1.3 MarkupSafe==1.1.1 matplotlib==3.3.4 more-itertools==4.2.0 numpy==1.19.5 olefile==0.46 openssh-wrapper==0.4 paramiko==2.7.2 Paste==3.5.0 PasteDeploy==2.1.1 PasteScript==2.0.2 pecan==1.3.3 Pillow==8.1.2 ply==3.11 prettytable==0.7.2 protobuf==3.12.4 proxmoxer==1.0.3 pycparser==2.21 pycurl==7.43.0.6 PyGObject==3.38.0 pyinotify==0.9.6 PyJWT==1.7.1 PyNaCl==1.5.0 pyOpenSSL==20.0.1 pyparsing==2.4.7 PySimpleSOAP==1.16.2 python-apt==2.2.1 python-dateutil==2.8.1 python-debian==0.1.39 python-debianbts==3.1.0 PyYAML==5.3.1 rados==2.0.0 rbd==2.0.0 reportbug==7.10.3+deb11u1 repoze.lru==0.7 requests==2.25.1 rgw==2.0.0 Routes==2.5.1 simplegeneric==0.8.1 simplejson==3.17.2 six==1.16.0 soupsieve==2.2.1 ssh-paramiko==0.1.2 systemd-python==234 Tempita==0.5.2 unattended-upgrades==0.1 urllib3==1.26.5 virtualenv==20.4.0+ds waitress==1.4.4 webencodings==0.5.1 WebOb==1.8.6 WebTest==2.0.35 Werkzeug==1.0.1 zipp==1.0.0 ``` I supposed that `proxmox.cluster.resources.get(type='vm')` return bad format ( array style instead of json style ) don't you know ?
Author
Owner

@samyscoub commented on GitHub (Feb 20, 2022):

I tried to upgrade paramikoto 2.9.2 , but not a better result

<!-- gh-comment-id:1046325068 --> @samyscoub commented on GitHub (Feb 20, 2022): I tried to upgrade `paramiko`to 2.9.2 , but not a better result
Author
Owner

@jhollowe commented on GitHub (Feb 21, 2022):

I've added debug output to the 1.2.0 codebase which outputs the command being run and its stdout and stderr output. Install it with pip install --upgrade git+https://github.com/jhollowe/proxmoxer.git@issue-87 and try running again. That will give you the raw string output of the command. We can then see if it is somehow faulty output from PVE or if proxmoxer is interpereting it wrong.

You can also use the latest development branch (installed via pip install --upgrade git+https://github.com/proxmoxer/proxmoxer.git@develop) and see if the issue persists with that code.

<!-- gh-comment-id:1047071200 --> @jhollowe commented on GitHub (Feb 21, 2022): I've added debug output to the 1.2.0 codebase which outputs the command being run and its stdout and stderr output. Install it with `pip install --upgrade git+https://github.com/jhollowe/proxmoxer.git@issue-87` and try running again. That will give you the raw string output of the command. We can then see if it is somehow faulty output from PVE or if proxmoxer is interpereting it wrong. You can also use the latest development branch (installed via `pip install --upgrade git+https://github.com/proxmoxer/proxmoxer.git@develop`) and see if the issue persists with that code.
Author
Owner

@samyscoub commented on GitHub (Feb 21, 2022):

@jhollowe : here is the result from your release branch :

>>> from proxmoxer import ProxmoxAPI                                                                                                                
>>> proxmox = ProxmoxAPI('localhost', user='root', backend='ssh_paramiko')
>>> for vm in proxmox.cluster.resources.get(type='vm'):
...     print("{0}/{1} {2} => {3} on {4}" .format(vm['type'], vm['vmid'], vm['name'], vm['status'], vm['node']))
...
running command:  pvesh get /cluster/resources -type 'vm' --output-format json
stdout: [{"cpu":0.00110556779892081,"disk":4632342528,"diskread":3703709696,"diskwrite":230408192,"hastate":"started","id":"lxc/100","maxcpu":2,"maxdisk":21003583488,"maxmem":2147483648,"mem":884146176,"name":
......
"status":"stopped","template":0,"type":"lxc","uptime":0,"vmid":128}]

stderr: open terminal failed: not a terminal
open terminal failed: not a terminal
open terminal failed: not a terminal
open terminal failed: not a terminal


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/dist-packages/proxmoxer/core.py", line 123, in get
    return self(args)._request("GET", params=params)
  File "/usr/local/lib/python3.9/dist-packages/proxmoxer/core.py", line 113, in _request
    raise ResourceException(
proxmoxer.core.ResourceException: 500 Internal Server Error: [{"
.....
,"status":"stopped","template":0,"type":"lxc","uptime":0,"vmid":128}]

same thing with developbranch

<!-- gh-comment-id:1047219322 --> @samyscoub commented on GitHub (Feb 21, 2022): @jhollowe : here is the result from your release branch : ```python >>> from proxmoxer import ProxmoxAPI >>> proxmox = ProxmoxAPI('localhost', user='root', backend='ssh_paramiko') >>> for vm in proxmox.cluster.resources.get(type='vm'): ... print("{0}/{1} {2} => {3} on {4}" .format(vm['type'], vm['vmid'], vm['name'], vm['status'], vm['node'])) ... running command: pvesh get /cluster/resources -type 'vm' --output-format json stdout: [{"cpu":0.00110556779892081,"disk":4632342528,"diskread":3703709696,"diskwrite":230408192,"hastate":"started","id":"lxc/100","maxcpu":2,"maxdisk":21003583488,"maxmem":2147483648,"mem":884146176,"name": ...... "status":"stopped","template":0,"type":"lxc","uptime":0,"vmid":128}] stderr: open terminal failed: not a terminal open terminal failed: not a terminal open terminal failed: not a terminal open terminal failed: not a terminal Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.9/dist-packages/proxmoxer/core.py", line 123, in get return self(args)._request("GET", params=params) File "/usr/local/lib/python3.9/dist-packages/proxmoxer/core.py", line 113, in _request raise ResourceException( proxmoxer.core.ResourceException: 500 Internal Server Error: [{" ..... ,"status":"stopped","template":0,"type":"lxc","uptime":0,"vmid":128}] ``` same thing with `develop`branch
Author
Owner

@jhollowe commented on GitHub (Feb 21, 2022):

The open terminal failed: not a terminal makes me think this is something with your terminal configuration. I suggest resetting your .bashrc and .profile to the defaults (should be in /etc/skel/) and see if that fixes it. It looks like PVE is working correctly and proxmoxer is working correctly, but something is adding the error line to the shell and thus proxmoxer sees it as an error. This error info should be presented to the user somehow so that will go on the to-do list, but this case seems to be an issue with your specific setup.

<!-- gh-comment-id:1047281406 --> @jhollowe commented on GitHub (Feb 21, 2022): The `open terminal failed: not a terminal` makes me think this is something with your terminal configuration. I suggest resetting your `.bashrc` and `.profile` to the defaults (should be in `/etc/skel/`) and see if that fixes it. It looks like PVE is working correctly and proxmoxer is working correctly, but something is adding the error line to the shell and thus proxmoxer sees it as an error. This error info should be presented to the user somehow so that will go on the to-do list, but this case seems to be an issue with your specific setup.
Author
Owner

@jhollowe commented on GitHub (Mar 12, 2022):

Closing due to solved with no response. Please reopen if that solution did not solve your issue.

<!-- gh-comment-id:1065951399 --> @jhollowe commented on GitHub (Mar 12, 2022): Closing due to solved with no response. Please reopen if that solution did not solve your issue.
Author
Owner

@samyscoub commented on GitHub (Apr 1, 2022):

@jhollowe : I've found the problem : when you have a down node from a cluster, proxmoxer library failed with this kind of error. When all nodes are aonline no problem. Maybe you can check that use case on your side ?

<!-- gh-comment-id:1086120969 --> @samyscoub commented on GitHub (Apr 1, 2022): @jhollowe : I've found the problem : when you have a down node from a cluster, proxmoxer library failed with this kind of error. When all nodes are aonline no problem. Maybe you can check that use case on your side ?
Author
Owner

@jhollowe commented on GitHub (May 14, 2022):

I have not been able to reproduce these errors in my testing. I'm going to close this for now since trying to support every weird thing that happens with a degraded cluster is not feasible.

<!-- gh-comment-id:1126816322 --> @jhollowe commented on GitHub (May 14, 2022): I have not been able to reproduce these errors in my testing. I'm going to close this for now since trying to support every weird thing that happens with a degraded cluster is not feasible.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmoxer#45
No description provided.