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

Panic running nomad operator snapshot agent from docs #8809

Closed
notnoop opened this issue Sep 1, 2020 · 2 comments
Closed

Panic running nomad operator snapshot agent from docs #8809

notnoop opened this issue Sep 1, 2020 · 2 comments
Labels
theme/enterprise Issues related to Enterprise features type/bug

Comments

@notnoop
Copy link
Contributor

notnoop commented Sep 1, 2020

Issue

panic: runtime error: invalid memory address running nomad operator snapshot agent config.hcl

Reproduction Steps

1 - Create the following configuration file, change the token, access_key_id, secret_access_key and S3 bucket values accordingly and save it as snap.hcl:

nomad {
	address = "http://127.0.0.1:4646"
	token = "management_token"
}

snapshot {
	interval = 0
	retain = 180
	stale = false
	service = "nomad-snapshot"
	deregister_after = "72h"
	lock_key = "nomad-snapshot/lock"
	max_failures = 3
	prefix = "nomad"
}

log {
	level = "DEBUG"
	enable_syslog = true
	syslog_facility = "LOCAL0"
}

aws_storage {
	access_key_id = "access_key_id"
	secret_access_key = "secret_access_key"
	s3_region = "us-east-1"
	s3_bucket = "s3_bucket_name"
	s3_key_prefix = "nomad-snapshot"
}

2 - Run nomad operator snapshot agent snap.hcl:

It fails with a runtime error.

ubuntu@ip-172-31-27-173:~$ nomad operator snapshot agent snap.hcl
Nomad snapshot agent running!
        Interval: "0s"
          Retain: 824635564512
           Stale: false
   Local Scratch: /tmp
            Mode: one-shot
Snapshot Storage: Amazon S3 -> Region: "us-east-1" Bucket: "rolt-s3-hc" Key Prefix: "nomad-snapshot" Snapshot Name: ""

Log data will now stream in as it occurs:

2020-08-24T21:42:12.908Z [INFO]  snapshotagent.license: automatic snapshot is licensed
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x272d836]

goroutine 1 [running]:
github.com/hashicorp/raft-snapshotagent.(*Agent).snapshotAndRotate(0xc000587040, 0x0, 0x0)
	github.com/hashicorp/[email protected]/agent.go:409 +0x176
github.com/hashicorp/raft-snapshotagent.(*Agent).Run(0xc000587040, 0x3b556c0, 0xc00057a880, 0x3b97740, 0xc00058e090)
	github.com/hashicorp/[email protected]/agent.go:144 +0x45d
github.com/hashicorp/nomad/command.(*OperatorSnapshotAgentCommand).Run(0xc00053a4d0, 0xc00004e0e0, 0x1, 0x1, 0x0)
	github.com/hashicorp/nomad/command/operator_snapshot_agent_ent.go:225 +0xe28
github.com/mitchellh/cli.(*CLI).Run(0xc0005c48c0, 0xc0005c48c0, 0xc0005c1180, 0x3c)
	github.com/mitchellh/[email protected]/cli.go:260 +0x1da
main.RunCustom(0xc00004e0b0, 0x4, 0x4, 0xc0000a2058)
	github.com/hashicorp/nomad/main.go:139 +0x48f
main.Run(...)
	github.com/hashicorp/nomad/main.go:84
main.main()
	github.com/hashicorp/nomad/main.go:80 +0x64
ubuntu@ip-172-31-27-173:~$

3 - Add local_storage block to the config file and run nomad operator snapshot agent snap.hcl again:

local_storage {
  path = "/tmp"
}

It works as expected:

ubuntu@ip-172-31-27-173:~$ nomad operator snapshot agent snap.hcl
Nomad snapshot agent running!
        Interval: "0s"
          Retain: 824635825624
           Stale: false
   Local Scratch: /tmp
            Mode: one-shot
Snapshot Storage: Amazon S3 -> Region: "us-east-1" Bucket: "rolt-s3-hc" Key Prefix: "nomad-snapshot" Snapshot Name: ""

Log data will now stream in as it occurs:

2020-08-24T21:43:18.347Z [INFO]  snapshotagent.license: automatic snapshot is licensed
2020-08-24T21:43:18.731Z [INFO]  snapshotagent.snapshot: Saved snapshot: id=1598305398362362752
2020-08-24T21:43:18.826Z [DEBUG] snapshotagent.snapshot: Rotated snapshots: number_deleted=0
ubuntu@ip-172-31-27-173:~$

Expected behavior


It should not panic and, as per the documentation, only one storage block should be required.

Workaround: Add local_storage block to the config or pass -local-path argument to the CLI command.

Environment

ubuntu@ip-172-31-27-173:~$ nomad version
Nomad v0.12.2+ent (4dcbc0741092b7955f77768a796ef088f18b9196)
ubuntu@ip-172-31-27-173:~$

ubuntu@ip-172-31-27-173:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.6 LTS
Release:	16.04
Codename:	xenial
ubuntu@ip-172-31-27-173:~$

ubuntu@ip-172-31-27-173:~$ nomad license get
Product        = nomad
License Status = valid
License ID     = temporary-license
Customer ID    = temporary license customer
Expires At     = 2020-08-25 03:37:36.831789619 +0000 UTC
Terminates At  = 2020-08-25 03:37:36.831789619 +0000 UTC
Datacenter     = *
Modules:
	governance-policy
	multicluster-and-efficiency
Licensed Features:
	Automated Upgrades
	Enhanced Read Scalability
	Redundancy Zones
	Namespaces
	Resource Quotas
	Audit Logging
	Sentinel Policies
	Multiregion Deployments
	Automated Backups
	Multi-Vault Namespaces
ubuntu@ip-172-31-27-173:~$
@notnoop notnoop added type/bug theme/enterprise Issues related to Enterprise features labels Sep 1, 2020
@notnoop
Copy link
Contributor Author

notnoop commented Sep 1, 2020

Fixed in 0.12.4

@notnoop notnoop closed this as completed Sep 1, 2020
@github-actions
Copy link

github-actions bot commented Nov 2, 2022

I'm going to lock this issue because it has been closed for 120 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 Nov 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme/enterprise Issues related to Enterprise features type/bug
Projects
None yet
Development

No branches or pull requests

1 participant