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

Fix a panic related to batch GC #4903

Merged
merged 4 commits into from
Nov 20, 2018
Merged

Commits on Nov 20, 2018

  1. Reproduce a panic related to batch GC

    Test case that reproduces a panic with the following stacktrace:
    
    ```
    panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    	panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x1149715]
    
    goroutine 35 [running]:
    testing.tRunner.func1(0xc0001e2200)
    	/usr/local/Cellar/go/1.11.2/libexec/src/testing/testing.go:792 +0x387
    panic(0x167e400, 0x1c43a30)
    	/usr/local/Cellar/go/1.11.2/libexec/src/runtime/panic.go:513 +0x1b9
    github.com/hashicorp/nomad/vendor/github.com/hashicorp/go-immutable-radix.(*Iterator).Next(0xc0003a4080, 0x17f7ba0, 0x0, 0xc0002e74a0, 0xc0003a0510, 0xc0003a0530, 0xc0003a0530)
    	/go/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/go-immutable-radix/iter.go:81 +0xa5
    github.com/hashicorp/nomad/vendor/github.com/hashicorp/go-memdb.(*radixIterator).Next(0xc0003a0420, 0x1756059, 0xb)
    	/go/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/go-memdb/txn.go:634 +0x2e
    github.com/hashicorp/nomad/nomad/state.(*StateStore).deleteJobVersions(0xc00028f7d0, 0x2711, 0xc0002e7680, 0xc000392100, 0xc0003a4040, 0x0)
    	/go/src/github.com/hashicorp/nomad/nomad/state/state_store.go:1130 +0x1a1
    github.com/hashicorp/nomad/nomad/state.(*StateStore).DeleteJobTxn(0xc00028f7d0, 0x2711, 0x175334f, 0x7, 0xc000306810, 0x2f, 0xc000392100, 0x0, 0x0)
    	/go/src/github.com/hashicorp/nomad/nomad/state/state_store.go:1102 +0x46c
    github.com/hashicorp/nomad/nomad/state.TestStateStore_DeleteJobTxn_BatchDeletes.func1(0xc000392100, 0x1777ce0, 0xc000392100)
    	/go/src/github.com/hashicorp/nomad/nomad/state/state_store_test.go:1705 +0x1a2
    github.com/hashicorp/nomad/nomad/state.(*StateStore).WithWriteTransaction(0xc00028f7d0, 0xc0000d5e48, 0x0, 0x0)
    	/go/src/github.com/hashicorp/nomad/nomad/state/state_store.go:3953 +0x79
    github.com/hashicorp/nomad/nomad/state.TestStateStore_DeleteJobTxn_BatchDeletes(0xc0001e2200)
    	/go/src/github.com/hashicorp/nomad/nomad/state/state_store_test.go:1703 +0x685
    testing.tRunner(0xc0001e2200, 0x1777138)
    	/usr/local/Cellar/go/1.11.2/libexec/src/testing/testing.go:827 +0xbf
    created by testing.(*T).Run
    	/usr/local/Cellar/go/1.11.2/libexec/src/testing/testing.go:878 +0x353
    ```
    Mahmood Ali committed Nov 20, 2018
    Configuration menu
    Copy the full SHA
    616ef21 View commit details
    Browse the repository at this point in the history
  2. Fix a panic related to batch GC

    `deleteJobVersions` does concurrent modifications to iterated items
    while iterating, by deleting job versions while it's iterating on them,
    Mahmood Ali committed Nov 20, 2018
    Configuration menu
    Copy the full SHA
    cf51bc6 View commit details
    Browse the repository at this point in the history
  3. add a missing no errorassertion

    Mahmood Ali committed Nov 20, 2018
    Configuration menu
    Copy the full SHA
    10b073a View commit details
    Browse the repository at this point in the history
  4. address review comments

    Mahmood Ali committed Nov 20, 2018
    Configuration menu
    Copy the full SHA
    72df87b View commit details
    Browse the repository at this point in the history