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

Packer Crash on macOS - Intermittent crashes with packer build - Panic: runtime error: index out of range [0] with length 0 #12430

Closed
bassem-shoukry opened this issue May 18, 2023 · 4 comments · Fixed by #12437
Labels
bug crash stage/waiting-on-upstream This issue is waiting on an upstream change

Comments

@bassem-shoukry
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

Overview of the Issue

Intermittent crashes with packer build. See subject/title. Packer requested I report this crash:

!!!!!!!!!!!!!!!!!!!!!!!!!!! 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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Reproduction Steps

packer build .

Packer version

1.8.7

Simplified Packer Template

Need private way to provide this. Also the crash.log.

Operating system and Environment details

macOS 11.7.6 (20G1231)

Log Fragments and crash.log files

see above.
Set the env var PACKER_LOG=1 for maximum log detail.
tail of crash log:

2023/05/18 11:51:27 [INFO] Packer version: 1.8.7 [go1.20.4 darwin amd64]
2023/05/18 11:51:27 [TRACE] discovering plugins in /usr/local/bin
2023/05/18 11:51:27 [TRACE] discovering plugins in /Users/bassemshoukry/.config/packer/plugins
2023/05/18 11:51:27 [TRACE] discovering plugins in .
2023/05/18 11:51:27 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2023/05/18 11:51:27 [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/bassemshoukry/.packerconfig
2023/05/18 11:51:27 [WARN] Config file doesn't exist: /Users/bassemshoukry/.packerconfig
2023/05/18 11:51:27 [INFO] Setting cache directory: /Users/bassemshoukry/.cache/packer
2023/05/18 11:51:27 waiting for all plugin processes to complete...
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/shirou/gopsutil/process.(*Process).createTimeWithContext(0xe0?, {0x65e9a20?, 0xc000078070?})
	github.com/shirou/gopsutil@v3.21.11+incompatible/process/process_darwin.go:139 +0x291
github.com/shirou/gopsutil/process.(*Process).CreateTimeWithContext(0xc00038a7e0, {0x65e9a20?, 0xc000078070?})
	github.com/shirou/gopsutil@v3.21.11+incompatible/process/process.go:275 +0x45
github.com/shirou/gopsutil/process.NewProcessWithContext({0x65e9a20, 0xc000078070}, 0xf5b)
	github.com/shirou/gopsutil@v3.21.11+incompatible/process/process.go:183 +0x69
github.com/shirou/gopsutil/process.NewProcess(...)
	github.com/shirou/gopsutil@v3.21.11+incompatible/process/process.go:168
main.checkProcess(0x5ed1e17?)
	github.com/hashicorp/packer/background_check.go:13 +0x2e
main.wrappedMain()
	github.com/hashicorp/packer/main.go:221 +0x7a5
main.realMain()
	github.com/hashicorp/packer/main.go:49 +0xf5
main.main()
	github.com/hashicorp/packer/main.go:35 +0x19
@github-actions github-actions bot added the crash label May 18, 2023
nywilken added a commit that referenced this issue May 24, 2023
This change updates gopsutil to the latest available version.

Fixes: #12430
@nywilken
Copy link
Contributor

Hi @bassem-shoukry thanks for reporting this issue. I suspect it is an upstream gopsutil issue. I opened a PR to upgrade gopsutil with a fix but would like to test with your repro config, and if you’re open to it have you test as well.

You can send your config/logs to us via email packer at hashicorp dot com. If you would like to encrypt the content you can use our GPG key https://www.hashicorp.com/security#pgp-public-key

@nywilken nywilken added the stage/waiting-on-upstream This issue is waiting on an upstream change label May 24, 2023
nywilken pushed a commit that referenced this issue May 25, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
This change updates gopsutil to the latest available version.

Fixes: #12430
@nywilken
Copy link
Contributor

Hi @bassem-shoukry I went ahead an merged in the change, which may resolve your issue. When possible can you please download the latest nightly release to test if the problem has been resolved.

@bassem-shoukry
Copy link
Author

Thank you @nywilken for your help! The updated version is working now.

@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 Jun 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug crash stage/waiting-on-upstream This issue is waiting on an upstream change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants