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

[bug] Nomad panics when attempting to scale a job by a negative value #7902

Closed
jrasell opened this issue May 8, 2020 · 1 comment · Fixed by #7903
Closed

[bug] Nomad panics when attempting to scale a job by a negative value #7902

jrasell opened this issue May 8, 2020 · 1 comment · Fixed by #7903
Assignees
Labels
theme/api HTTP API and SDK issues theme/autoscaling Issues related to supporting autoscaling type/bug

Comments

@jrasell
Copy link
Member

jrasell commented May 8, 2020

Nomad version

Version: Nomad v0.11.2-dev
Commit: f5c84fca8e128be8ff609f3b6bfc0230a25d3adf

Operating system and Environment details

Reproduced on Mac and Linux amd64.

Issue

When attempting to scale a job task group by a negative value, the Nomad server panics.

Reproduction steps

  • run Nomad locally via nomad agent -dev
  • register the job as defined below nomad run <jobfile>
  • attempt to scale using the payload below curl --request POST --data @payload.json http://localhost:4646/v1/job/example/scale
  • observe Nomad panic

Job file

job "example" {
  datacenters = ["dc1"]

  group "cache" {

    count = 1

    task "redis" {
      driver = "docker"

      config {
        image = "redis:3.2"
      }
    }
  }
}

API Payload

{
  "Count": -1,
  "Target": {
    "Group": "cache"
  }
}

Nomad Logs

panic: bitmap must be positive size

goroutine 122 [running]:
github.com/hashicorp/nomad/scheduler.bitmapFrom(0xc001b89d40, 0xffffffffffffffff, 0x2, 0x2, 0xc001b89d40)
/Users/jrasell/go/src/github.com/hashicorp/nomad/scheduler/reconcile_util.go:428 +0x25c
github.com/hashicorp/nomad/scheduler.newAllocNameIndex(...)
/Users/jrasell/go/src/github.com/hashicorp/nomad/scheduler/reconcile_util.go:387
github.com/hashicorp/nomad/scheduler.(*allocReconciler).computeGroup(0xc00072b040, 0xc001396740, 0x5, 0xc001b89c20, 0xc001b89b90)
/Users/jrasell/go/src/github.com/hashicorp/nomad/scheduler/reconcile.go:362 +0x339
github.com/hashicorp/nomad/scheduler.(*allocReconciler).Compute(0xc00072b040, 0xc001b894a0)
/Users/jrasell/go/src/github.com/hashicorp/nomad/scheduler/reconcile.go:207 +0x170
github.com/hashicorp/nomad/scheduler.(*GenericScheduler).computeJobAllocs(0xc00072a820, 0xc00000d2c0, 0xc0002693b0)
/Users/jrasell/go/src/github.com/hashicorp/nomad/scheduler/generic_sched.go:347 +0x337
github.com/hashicorp/nomad/scheduler.(*GenericScheduler).process(0xc00072a820, 0x0, 0x0, 0x0)
/Users/jrasell/go/src/github.com/hashicorp/nomad/scheduler/generic_sched.go:254 +0x35e
github.com/hashicorp/nomad/scheduler.retryMax(0x5, 0xc000bfbe00, 0xc000bfbdf0, 0x6, 0x6f650a0)
/Users/jrasell/go/src/github.com/hashicorp/nomad/scheduler/util.go:280 +0x56
github.com/hashicorp/nomad/scheduler.(*GenericScheduler).Process(0xc00072a820, 0xc0013f1800, 0x6f650a0, 0xc00095eff0)
/Users/jrasell/go/src/github.com/hashicorp/nomad/scheduler/generic_sched.go:153 +0x28c
github.com/hashicorp/nomad/nomad.(*Worker).invokeScheduler(0xc0005152d0, 0xc001b89320, 0xc0013f1800, 0xc0010cfc80, 0x24, 0x0, 0x0)
/Users/jrasell/go/src/github.com/hashicorp/nomad/nomad/worker.go:268 +0x421
github.com/hashicorp/nomad/nomad.(*Worker).run(0xc0005152d0)
/Users/jrasell/go/src/github.com/hashicorp/nomad/nomad/worker.go:129 +0x294
created by github.com/hashicorp/nomad/nomad.NewWorker
/Users/jrasell/go/src/github.com/hashicorp/nomad/nomad/worker.go:81 +0x152
@jrasell jrasell added type/bug theme/api HTTP API and SDK issues theme/autoscaling Issues related to supporting autoscaling labels May 8, 2020
@jrasell jrasell self-assigned this May 8, 2020
jrasell added a commit that referenced this issue May 11, 2020
jrasell added a commit that referenced this issue May 11, 2020
@github-actions
Copy link

github-actions bot commented Nov 7, 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 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
theme/api HTTP API and SDK issues theme/autoscaling Issues related to supporting autoscaling type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant