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

CLI Job validate SIGSEGV with job type=system and migrate stanza #5477

Closed
benagricola opened this issue Mar 27, 2019 · 2 comments · Fixed by #5486
Closed

CLI Job validate SIGSEGV with job type=system and migrate stanza #5477

benagricola opened this issue Mar 27, 2019 · 2 comments · Fixed by #5486

Comments

@benagricola
Copy link

Nomad version

Nomad v0.9.0-rc1 (7c00ab4)

Affects 0.8.7 at least as well

Operating system and Environment details

Darwin 18.2, Linux, etc

Issue

A job file with type = "system" and containing a job:migrate{} stanza causes nomad validate <job>.nomad to panic if a group is defined.

Change the type to service and validate successfully runs, complaining about missing tasks.

Reproduction steps

Create job files from below.

Validate job file with service scheduler:

~/d/nomad> ./nomad job validate panic.nomad 
Job validation errors:
2 error(s) occurred:

* Missing job datacenters
* Task group panicgrp validation failed: 1 error(s) occurred:

* Missing tasks for task group

Validate job file with system scheduler:

~/d/nomad> ./nomad job validate panic.nomad 
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x53276f9]

goroutine 1 [running]:
github.com/hashicorp/nomad/command/agent.ApiTgToStructsTG(0xc0002e5540, 0xc0000ca4d0)
        /tmp/nomad-workspace/2019-03-21-1553195760/gopath/src/github.com/hashicorp/nomad/command/agent/job_endpoint.go:691 +0x5c9
github.com/hashicorp/nomad/command/agent.ApiJobToStructJob(0xc0003fa000, 0xc00043a180)
        /tmp/nomad-workspace/2019-03-21-1553195760/gopath/src/github.com/hashicorp/nomad/command/agent/job_endpoint.go:656 +0x45f
github.com/hashicorp/nomad/command.(*JobValidateCommand).validateLocal(0xc000128370, 0xc0003fa000, 0x0, 0xc0001e4f80, 0x0)
        /tmp/nomad-workspace/2019-03-21-1553195760/gopath/src/github.com/hashicorp/nomad/command/job_validate.go:120 +0x5d
github.com/hashicorp/nomad/command.(*JobValidateCommand).Run(0xc000128370, 0xc00003a1b0, 0x1, 0x1, 0xc00030e1b0)
        /tmp/nomad-workspace/2019-03-21-1553195760/gopath/src/github.com/hashicorp/nomad/command/job_validate.go:85 +0x69a
github.com/hashicorp/nomad/vendor/github.com/mitchellh/cli.(*CLI).Run(0xc00027a640, 0xc00027a640, 0xc0001d4560, 0x3b)
        /tmp/nomad-workspace/2019-03-21-1553195760/gopath/src/github.com/hashicorp/nomad/vendor/github.com/mitchellh/cli/cli.go:255 +0x207
main.RunCustom(0xc00003a190, 0x3, 0x3, 0x0)
        /tmp/nomad-workspace/2019-03-21-1553195760/gopath/src/github.com/hashicorp/nomad/main.go:131 +0x48e
main.Run(0xc00003a190, 0x3, 0x3, 0xc00009e058)
        /tmp/nomad-workspace/2019-03-21-1553195760/gopath/src/github.com/hashicorp/nomad/main.go:76 +0x3f
main.main()
        /tmp/nomad-workspace/2019-03-21-1553195760/gopath/src/github.com/hashicorp/nomad/main.go:72 +0x62

Job file (if appropriate)

panic.nomad

job "panic" {
    type = "system"
    migrate {}
    group "panicgrp" {}
}

nopanic.nomad

job "panic" {
    type = "service"
    migrate {}
    group "panicgrp" {}
}
schmichael added a commit that referenced this issue Mar 28, 2019
Fixes Migrate to be initialized like RescheduleStrategy.

Fixes #5477
@schmichael
Copy link
Member

Thanks for the report and reproducer @benagricola!

Fixed in #5486, but I'm holding off merging until post-0.9.0 as we're trying to minimize changes during the release candidate period.

schmichael added a commit that referenced this issue Apr 11, 2019
Fixes Migrate to be initialized like RescheduleStrategy.

Fixes #5477
@github-actions
Copy link

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 24, 2022
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