Skip to content

fix: log a Proxmox error once, with one stack trace - #176

Merged
ericwang401 merged 1 commit into
4.xfrom
fix/proxmox-error-logs
Oct 16, 2026
Merged

ericwang401 merged 1 commit into
4.xfrom
fix/proxmox-error-logs

Conversation

@ericwang401

Copy link
Copy Markdown
Collaborator

Every error from Proxmox logged its stack trace three times, about 256 lines per error. A page polling a server whose VM was gone wrote one of those every few seconds.

Cause

ProxmoxConnectionException built its message from the RequestException's message plus getTraceAsString(), and chained that RequestException as the previous exception. Laravel then printed the trace inside the message, again for the exception, and again for the previous one. All three were thrown from the same line.

Changes

  • Message: now Proxmox returned <status>: <Proxmox's error>. The error comes from the response's JSON message, then the reason phrase, then the HTTP client's message.
  • No chained exception: the response is kept as a public readonly Response $response for callers that need Proxmox's answer.
  • ISO link check: still works, because it looks for Proxmox's "Can't connect to" text, which stays in the message.

Testing

  • Pest: the message carries no trace and nothing is chained. The fallback when Proxmox sends no JSON still includes the client's error.
  • Real node: reporting the error for a missing VM now writes one 32-line entry with a single trace. It used to be 256 lines with three traces.

Notes

ProxmoxConnectionException's message was the RequestException's message
plus its getTraceAsString(), and the RequestException was chained as the
previous exception. A logged Proxmox error therefore printed the trace
three times -- in the message, for the exception, and for the previous
one, thrown from the same line -- about 256 lines per error. A page
polling a server whose VM is gone wrote one of those every few seconds.

The message is now "Proxmox returned <status>: <Proxmox's error>", taken
from the response's JSON message, then its reason phrase, then the HTTP
client's message. Nothing is chained; the response is kept on the
exception as a public readonly property for callers that need it. A real
error from a node now logs as one 32-line entry with a single trace.

The ISO link check, which looks for Proxmox's "Can't connect to" in the
message, still finds it: that text is Proxmox's error, not the trace.
ericwang401 added a commit that referenced this pull request Oct 16, 2026
isVmMissingError() read the response off the RequestException that ProxmoxConnectionException wrapped. #176 stops wrapping it and keeps the response on the exception instead, so read $e->response first and fall back to the wrapped one. The "does not exist" check then works whichever of the two PRs merges first; #172's tests pass against both versions of the exception.
@ericwang401
ericwang401 merged commit dc581bc into 4.x Oct 16, 2026
3 checks passed
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 this pull request may close these issues.

1 participant