grafana/xk6-chaos

invalid memory address or nil pointer dereference

Opened this issue · 1 comments

Running the example from README.md results in the below errors. Please check.

INFO[0000] Running grafana/xk6-chaos@v0.0.2.             source=console
ERRO[0000] panic: runtime error: invalid memory address or nil pointer dereference
goroutine 79 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
go.k6.io/k6/js/common.RunWithPanicCatching.func1()
        go.k6.io/k6@v0.38.3/js/common/util.go:101 +0x191
panic({0x1afa5e0, 0x3189400})
        runtime/panic.go:838 +0x207
github.com/dop251/goja.AssertFunction.func1.1()
        github.com/dop251/goja@v0.0.0-20220405120441-9037c2b61cbf/runtime.go:2300 +0x6e
panic({0x1afa5e0, 0x3189400})
        runtime/panic.go:838 +0x207
github.com/dop251/goja.(*vm).try.func1()
        github.com/dop251/goja@v0.0.0-20220405120441-9037c2b61cbf/vm.go:537 +0x635
panic({0x1afa5e0, 0x3189400})
        runtime/panic.go:838 +0x207
golang.org/x/time/rate.(*Limiter).WaitN(0xc000c680a0, {0x0, 0x0}, 0x1)
        golang.org/x/time@v0.0.0-20220224211638-0e9765cccd65/rate/rate.go:234 +0x1bd
golang.org/x/time/rate.(*Limiter).Wait(...)
        golang.org/x/time@v0.0.0-20220224211638-0e9765cccd65/rate/rate.go:216
k8s.io/client-go/util/flowcontrol.(*tokenBucketRateLimiter).Wait(0x214e840?, {0x0?, 0x0?})
        k8s.io/client-go@v0.21.0/util/flowcontrol/throttle.go:106 +0x2b
k8s.io/client-go/rest.(*Request).tryThrottleWithInfo(0xc000c38690, {0x0, 0x0}, {0x0, 0x0})
        k8s.io/client-go@v0.21.0/rest/request.go:587 +0xba
k8s.io/client-go/rest.(*Request).tryThrottle(...)
        k8s.io/client-go@v0.21.0/rest/request.go:613
k8s.io/client-go/rest.(*Request).request(0xc000c38690, {0x0, 0x0}, 0x318ee50?)
        k8s.io/client-go@v0.21.0/rest/request.go:873 +0x29d
k8s.io/client-go/rest.(*Request).Do(0x7ff24e7c5da8?, {0x0?, 0x0?})
        k8s.io/client-go@v0.21.0/rest/request.go:980 +0xc7
k8s.io/client-go/kubernetes/typed/core/v1.(*pods).List(0xc000440780, {0x0, 0x0}, {{{0x0, 0x0}, {0x0, 0x0}}, {0x0, 0x0}, {0x0, ...}, ...})
        k8s.io/client-go@v0.21.0/kubernetes/typed/core/v1/pod.go:100 +0x185
github.com/grafana/xk6-chaos/internal/k8s/pods.(*Pods).List(0x5?, {0x0, 0x0}, {0x0?, 0x8?})
        github.com/grafana/xk6-chaos@v0.0.4/internal/k8s/pods/pods.go:25 +0x8c
reflect.Value.call({0x1b9cdc0?, 0xc0002d9310?, 0x7ff2754cbf18?}, {0x1d85ca0, 0x4}, {0xc00242af30, 0x2, 0xc000c5cf80?})
        reflect/value.go:556 +0x845
reflect.Value.Call({0x1b9cdc0?, 0xc0002d9310?, 0x6c802f?}, {0xc00242af30, 0x2, 0x2})
        reflect/value.go:339 +0xbf
github.com/dop251/goja.(*Runtime).wrapReflectFunc.func1({{0x214a878, 0xc00242aa20}, {0xc0015e42d0, 0x0, 0x3}})
        github.com/dop251/goja@v0.0.0-20220405120441-9037c2b61cbf/runtime.go:1886 +0x1c5
github.com/dop251/goja.(*vm)._nativeCall(0xc0025ca000, 0xc000c41e00, 0x0)
        github.com/dop251/goja@v0.0.0-20220405120441-9037c2b61cbf/vm.go:2727 +0x217
github.com/dop251/goja.call.exec(0x4?, 0xc0025ca000)
        github.com/dop251/goja@v0.0.0-20220405120441-9037c2b61cbf/vm.go:2699 +0x95b
github.com/dop251/goja.(*vm).run(0xc0025ca000)
        github.com/dop251/goja@v0.0.0-20220405120441-9037c2b61cbf/vm.go:408 +0x8b
github.com/dop251/goja.(*baseJsFuncObject)._call(0xc001990210, {{0x214b160, 0x31e6fc0}, {0xc0010f8d40, 0x1, 0x1}}, {0x0?, 0x0}, {0x214b160, 0x31e6fc0})
        github.com/dop251/goja@v0.0.0-20220405120441-9037c2b61cbf/func.go:193 +0x3ff
github.com/dop251/goja.(*baseJsFuncObject).call(...)
        github.com/dop251/goja@v0.0.0-20220405120441-9037c2b61cbf/func.go:203
github.com/dop251/goja.(*baseJsFuncObject).Call(0xc000780000?, {{0x214b160, 0x31e6fc0}, {0xc0010f8d40, 0x1, 0x1}})
        github.com/dop251/goja@v0.0.0-20220405120441-9037c2b61cbf/func.go:156 +0xc7
github.com/dop251/goja.AssertFunction.func1.2()
        github.com/dop251/goja@v0.0.0-20220405120441-9037c2b61cbf/runtime.go:2305 +0x74
github.com/dop251/goja.(*vm).try(0xc00078d638?, 0x40d325?)
        github.com/dop251/goja@v0.0.0-20220405120441-9037c2b61cbf/vm.go:545 +0x176
github.com/dop251/goja.AssertFunction.func1({0x214b160?, 0x31e6fc0?}, {0xc0010f8d40?, 0x1?, 0x1?})   
        github.com/dop251/goja@v0.0.0-20220405120441-9037c2b61cbf/runtime.go:2304 +0x10c
go.k6.io/k6/js.(*VU).runFn.func1.1()
        go.k6.io/k6@v0.38.3/js/runner.go:800 +0x43
go.k6.io/k6/js/eventloop.(*EventLoop).Start(0xc000416140, 0xc001f51e00)
        go.k6.io/k6@v0.38.3/js/eventloop/eventloop.go:112 +0x177
go.k6.io/k6/js.(*VU).runFn.func1()
        go.k6.io/k6@v0.38.3/js/runner.go:799 +0xee
go.k6.io/k6/js/common.RunWithPanicCatching({0x214dd40?, 0xc000474a80?}, 0x8?, 0x90?)
        go.k6.io/k6@v0.38.3/js/common/util.go:105 +0x87
go.k6.io/k6/js.(*VU).runFn(0xc000671b80, {0x213f0d0, 0xc001660c00}, 0xa0?, 0xc000166330, 0xc0010f8d20, {0xc0010f8d40, 0x1, 0x1})
        go.k6.io/k6@v0.38.3/js/runner.go:798 +0x2a5
go.k6.io/k6/js.(*ActiveVU).RunOnce(0xc001660bc0)
        go.k6.io/k6@v0.38.3/js/runner.go:750 +0x40f
go.k6.io/k6/lib/executor.getIterationRunner.func1({0x213f178, 0xc001f51ad0}, {0x2127940?, 0xc001660bc0?})
        go.k6.io/k6@v0.38.3/lib/executor/helpers.go:145 +0x64
go.k6.io/k6/lib/executor.PerVUIterations.Run.func3({0x212ddc0, 0xc000671b80})
        go.k6.io/k6@v0.38.3/lib/executor/per_vu_iterations.go:236 +0x40a
created by go.k6.io/k6/lib/executor.PerVUIterations.Run
        go.k6.io/k6@v0.38.3/lib/executor/per_vu_iterations.go:249 +0xbf8

Goja stack:
native

running (00m00.1s), 0/1 VUs, 0 complete and 1 interrupted iterations
default ✗ [======================================] 1 VUs  00m00.0s/10m0s  1/1 iters, 1 per VU        
WARN[0000] No script iterations finished, consider making the test duration longer

@QAInsights, thanks for reporting.

We are working on a new version of this extension.

Meanwhile, as an alternative, you could kill Kubernetes pods from your k6 tests using xk6-kubernetes, check out pod.delete.