[PR #240] [MERGED] client/CreateQemuVM: only read body if existing #334

Closed
opened 2026-02-28 00:41:48 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Telmate/proxmox-api-go/pull/240
Author: @lbajolet-hashicorp
Created: 2/22/2023
Status: Merged
Merged: 3/2/2023
Merged by: @mleone87

Base: masterHead: fix_crash_create_qemu_vm


📝 Commits (1)

  • f63ca55 client/CreateQemuVM: only read body if existing

📊 Changes

1 file changed (+12 additions, -6 deletions)

View changed files

📝 proxmox/client.go (+12 -6)

📄 Description

Working on Packer, we noticed that on many occasions the plugin crashes because the call to resp.Body.Close() panics with a null pointer dereference.

Unsure if this is because the resp object is null, or if the resp.Body is, but to avoid this problem, we only read and defer closing the body when it is available.

See for example the following issues:

Please let me know if there's anything I can do to help test this, I don't have a Proxmox installation to test it on, and am mostly going with the stack traces provided in the aforementioned issues.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Telmate/proxmox-api-go/pull/240 **Author:** [@lbajolet-hashicorp](https://github.com/lbajolet-hashicorp) **Created:** 2/22/2023 **Status:** ✅ Merged **Merged:** 3/2/2023 **Merged by:** [@mleone87](https://github.com/mleone87) **Base:** `master` ← **Head:** `fix_crash_create_qemu_vm` --- ### 📝 Commits (1) - [`f63ca55`](https://github.com/Telmate/proxmox-api-go/commit/f63ca55c3a6174f85effcdfa05ecd303b526d7d3) client/CreateQemuVM: only read body if existing ### 📊 Changes **1 file changed** (+12 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `proxmox/client.go` (+12 -6) </details> ### 📄 Description Working on Packer, we noticed that on many occasions the plugin crashes because the call to `resp.Body.Close()` panics with a null pointer dereference. Unsure if this is because the `resp` object is null, or if the `resp.Body` is, but to avoid this problem, we only read and defer closing the body when it is available. See for example the following issues: * https://github.com/hashicorp/packer-plugin-proxmox/issues/134 * https://github.com/hashicorp/packer-plugin-proxmox/issues/137 * https://github.com/hashicorp/packer-plugin-proxmox/issues/162 Please let me know if there's anything I can do to help test this, I don't have a Proxmox installation to test it on, and am mostly going with the stack traces provided in the aforementioned issues. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 00:41:48 +03:00
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/proxmox-api-go#334
No description provided.