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

critical failure in 1.9.3: panic: runtime error: invalid memory address or nil pointer dereference #12591

Closed
okamilobo opened this issue Aug 17, 2023 · 8 comments · Fixed by #12592

Comments

@okamilobo
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

The Azure Devops Packer Tool Installer just started pulling in 1.9.3 version a few minutes ago.

Error message:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x262681a]

goroutine 1 [running]:
github.com/hashicorp/packer/packer.(*CheckpointTelemetry).SetBundledUsage(...)
github.com/hashicorp/packer/packer/telemetry.go:135
github.com/hashicorp/packer/command.(*Meta).DetectBundledPlugins(0xc0003e2140?, {0x38d9320?, 0xc0003e2140?})
github.com/hashicorp/packer/command/meta.go:199 +0x11a
github.com/hashicorp/packer/command.(*ValidateCommand).RunContext(0xc0006ee900, {0xc000112360?, 0xb?}, 0xc0005fa000)
github.com/hashicorp/packer/command/validate.go:77 +0x109
github.com/hashicorp/packer/command.(*ValidateCommand).Run(0xc0006ee900, {0xc000112360, 0xb, 0xb})
github.com/hashicorp/packer/command/validate.go:28 +0xc5
github.com/mitchellh/cli.(*CLI).Run(0xc00038bcc0)
github.com/mitchellh/cli@v1.1.2/cli.go:262 +0x5f8
main.wrappedMain()
github.com/hashicorp/packer/main.go:265 +0xcc5
main.realMain()
github.com/hashicorp/packer/main.go:52 +0xf5
main.main()
github.com/hashicorp/packer/main.go:38 +0x19

Reproduction Steps

  1. Checkout your code.
  2. Install Packer through customer packer install task
  3. Validate Packer configuration through:
    Task : Packer
    Description : Build Automated Machine Images
    Version : 1.185.2019
    Author : Manuel Riezebosch
    Help : More information

Packer version

From packer version
##[debug]isExplicit: 1.9.3

Simplified Packer Template

If the file is longer than a few dozen lines, please include the URL to the
gist of the log or use the Github detailed
format

instead of posting it directly in the issue.

Operating system and Environment details

AWS - AMI latest version of: ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server

OS, Architecture, and any other information you can provide about the
environment.

Log Fragments and crash.log files

Will attach when I find it.

Include appropriate log fragments. If the log is longer than a few dozen lines,
please include the URL to the gist of the log or
use the Github detailed format instead of posting it directly in the issue.

Set the env var PACKER_LOG=1 for maximum log detail.

@okamilobo
Copy link
Author

There is no crash.log to found on the server.

@okamilobo
Copy link
Author

working around for now by pinning to 1.9.2, but would prefer not to have to pin.

@nywilken
Copy link
Contributor

nywilken commented Aug 18, 2023

Thanks for reporting @okamilobo this looks like a crash related to the recent bundle plugins telemetry check. The provide information is helpful and I suspect others will have similar issues.

Are you using a Packer JSON template?

Looking at the provided error I suspect that the Azure DevOps pipeline may be running with the CHECKPOINT_DISABLE env variable set. I have to setup a test DevOps pipeline on Azure to test this. But locally I am able to reproduce this error by removing any externally installed versions of the Azure plugin, causing Packer to use the bundled version of Azure, and disabling checkpoint. The use of bundled plugins is surprising as I would expect Azure DevOps to use an external Azure plugin seeing as the one bundled with Packer is out of date. We will get this fixed as soon as possible.

Again, I am not yet familiar with the Azure Packer task but it does look like the task allows you to run a packer init command before validate. Using an HCL2 template with a required_plugins block will ensure you are using a non-bundled version of the Azure plugin and will workaround this issue without having to pin to version 1.9.2. If you are using a legacy JSON template you can run packer hcl2_upgrade <your-template> to generate a HCL2 equivalent of your template


repro steps

~> rm -rf ~/.packer.d/plugins/github.com
~>  CHECKPOINT_DISABLE=1 packer validate ../packer-templates/azure-arm/azure-arm_custom_key_vault.json
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x50 pc=0x104ea5944]

goroutine 1 [running]:
github.com/hashicorp/packer/packer.(*CheckpointTelemetry).SetBundledUsage(...)
	/Users/dev/Development/packer-local-dev/packer/telemetry.go:135
github.com/hashicorp/packer/command.(*Meta).DetectBundledPlugins(0x106179e38?, {0x10617cc50?, 0x1400049eb00?})
	/Users/dev/Development/packer-local-dev/command/meta.go:199 +0xf4
github.com/hashicorp/packer/command.(*ValidateCommand).RunContext(0x14000950150, {0x1400011a1a0?, 0x1?}, 0x1400049e780)
	/Users/dev/Development/packer-local-dev/command/validate.go:77 +0xd8
github.com/hashicorp/packer/command.(*ValidateCommand).Run(0x14000950150, {0x1400011a1a0, 0x1, 0x1})
	/Users/dev/Development/packer-local-dev/command/validate.go:28 +0xac
github.com/mitchellh/cli.(*CLI).Run(0x140003e4280)
	/Users/dev/Development/go/pkg/mod/github.com/mitchellh/cli@v1.1.2/cli.go:262 +0x4a8
main.wrappedMain()
	/Users/dev/Development/packer-local-dev/main.go:265 +0xb40
main.realMain()
	/Users/dev/Development/packer-local-dev/main.go:52 +0xb8
main.main()
	/Users/dev/Development/packer-local-dev/main.go:38 +0x1c



!!!!!!!!!!!!!!!!!!!!!!!!!!! PACKER CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Packer crashed! This is always indicative of a bug within Packer.
A crash log has been placed at "crash.log" relative to your current
working directory. It would be immensely helpful if you could please
report the crash with Packer[1] so that we can fix this.

[1]: https://github.com/hashicorp/packer/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! PACKER CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Checkpoint enabled does not trigger this panic

~>  packer validate ../packer-templates/azure-arm/azure-arm_custom_key_vault.json
Warning: Bundled plugins used

This template relies on the use of plugins bundled into the Packer binary.
The practice of bundling external plugins into Packer will be removed in an
upcoming version.

To remove this warning and ensure builds keep working you can install these
external plugins with the 'packer plugins install' command

* packer plugins install github.com/hashicorp/azure

Alternatively, if you upgrade your templates to HCL2, you can use 'packer init'
with a 'required_plugins' block to automatically install external plugins.

You can try HCL2 by running 'packer hcl2_upgrade
/Users/dev/Development/packer-templates/azure-arm/azure-arm_custom_key_vault.json'

@nywilken
Copy link
Contributor

The fix for this has been merged in #12592 we will get a release out soon. I’ll keep this issue open for now incase another folks run into this issue.

@okamilobo
Copy link
Author

okamilobo commented Aug 18, 2023

I'm using hcl files, not json for configuration. I gave Init a chance and it did not help the validate step.

@nywilken
Copy link
Contributor

I'm using hcl files, not json for configuration. I gave Init a chance and it did not help the validate step.

Thanks for trying out init. We have a fix that will be released today. Could you share a template for reproduction.

Is there a way to check if the env. variable CHECKPOINT_DISABLE is being set?

As we looked into the issue further we found that even if you are using external plugins and at least one bundled plugin you will hit this error if CHECKPOINT_DISABLE is set.

@nywilken
Copy link
Contributor

This issue has been resolved in Packer 1.9.4.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants