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

k6 panic if pushParameterized minSize>maxSize #50

Open
mstoykov opened this issue Oct 31, 2022 · 1 comment
Open

k6 panic if pushParameterized minSize>maxSize #50

mstoykov opened this issue Oct 31, 2022 · 1 comment

Comments

@mstoykov
Copy link
Contributor

Running

import loki from "k6/x/loki"

const conf = new loki.Config("https://somewhere.com", 20000, 1.0, { one: 1 });
const client = new loki.Client(conf);

export default function() {
  client.pushParameterized(1, 1000, 1000);
};

panics. But it should likely just be a js exception.

@mstoykov
Copy link
Contributor Author

Stacktrace:

ERRO[0000] panic: invalid argument to Intn
goroutine 81 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
go.k6.io/k6/js/common.RunWithPanicCatching.func1()
        go.k6.io/[email protected]/js/common/util.go:82 +0x191
panic({0x150ee40, 0x1ab48d0})
        runtime/panic.go:884 +0x212
github.com/dop251/goja.(*Runtime).runWrapped.func1()
        github.com/dop251/[email protected]/runtime.go:2437 +0xdc
panic({0x150ee40, 0x1ab48d0})
        runtime/panic.go:884 +0x212
github.com/dop251/goja.(*vm).try.func1()
        github.com/dop251/[email protected]/vm.go:626 +0x70f
panic({0x150ee40, 0x1ab48d0})
        runtime/panic.go:884 +0x212
math/rand.(*Rand).Intn(0xc0005e4100?, 0xf0?)
        math/rand/rand.go:168 +0x65
math/rand.Intn(...)
        math/rand/rand.go:337
github.com/grafana/xk6-loki.(*Client).newBatch(0xc0024bfda0, 0x0?, 0x1, 0x3e8, 0x3e8)
        github.com/grafana/[email protected]/batch.go:157 +0x168
github.com/grafana/xk6-loki.(*Client).PushParameterized(_, _, _, _)
        github.com/grafana/[email protected]/client.go:239 +0x1a5
reflect.Value.call({0x1708ca0?, 0xc0024bfda0?, 0x7f8101687108?}, {0x1788ffc, 0x4}, {0xc00077dcc0, 0x3, 0xc00062d068?})
        reflect/value.go:584 +0x8c5
reflect.Value.Call({0x1708ca0?, 0xc0024bfda0?, 0xc001f64ff0?}, {0xc00077dcc0?, 0xc0004d2080?, 0x1708ca0?})
        reflect/value.go:368 +0xbc
github.com/dop251/goja.(*Runtime).wrapReflectFunc.func1({{0x1adcc78, 0xc001e205a0}, {0xc0009c4550, 0x3, 0xb}})
        github.com/dop251/[email protected]/runtime.go:1980 +0x1da
github.com/dop251/goja.(*vm)._nativeCall(0xc0000bfb00, 0xc0001ac3c0, 0x3)
        github.com/dop251/[email protected]/vm.go:3233 +0x1e3
github.com/dop251/goja.call.exec(0x11?, 0xc0000bfb00)
        github.com/dop251/[email protected]/vm.go:3205 +0x14d
github.com/dop251/goja.(*vm).run(0xc0000bfb00)
        github.com/dop251/[email protected]/vm.go:495 +0x8b
github.com/dop251/goja.(*baseJsFuncObject)._call(0xc0001ab500, {0xc000847900?, 0x1, 0x0?}, {0x0?, 0x0}, {0x1add5f8?, 0x28bd6e0?})
        github.com/dop251/[email protected]/func.go:318 +0x3f8
github.com/dop251/goja.(*baseJsFuncObject).call(...)
        github.com/dop251/[email protected]/func.go:328
github.com/dop251/goja.(*baseJsFuncObject).Call(0x203000?, {{0x1add5f8, 0x28bd6e0}, {0xc000847900, 0x1, 0x1}})
        github.com/dop251/[email protected]/func.go:280 +0xa5
github.com/dop251/goja.AssertFunction.func1.1()
        github.com/dop251/[email protected]/runtime.go:2397 +0x74
github.com/dop251/goja.(*vm).try(0xc0000bfb00, 0x400?)
        github.com/dop251/[email protected]/vm.go:634 +0x18a
github.com/dop251/goja.(*Runtime).runWrapped(0xc00210d500, 0x8?)
        github.com/dop251/[email protected]/runtime.go:2441 +0x7c
github.com/dop251/goja.AssertFunction.func1({0x1add5f8?, 0x28bd6e0?}, {0xc000847900?, 0x1?, 0x1?})
        github.com/dop251/[email protected]/runtime.go:2396 +0x92
go.k6.io/k6/js.(*VU).runFn.func2.1()
        go.k6.io/[email protected]/js/runner.go:774 +0x43
go.k6.io/k6/js/eventloop.(*EventLoop).Start(0xc00077d4a0, 0xc001f559e0)
        go.k6.io/[email protected]/js/eventloop/eventloop.go:171 +0x1b7
go.k6.io/k6/js.(*VU).runFn.func2()
        go.k6.io/[email protected]/js/runner.go:773 +0xeb
go.k6.io/k6/js/common.RunWithPanicCatching({0x1ae2a20?, 0xc000a01100?}, 0x40f6e6?, 0x15a7560?)
        go.k6.io/[email protected]/js/common/util.go:86 +0x87
go.k6.io/k6/js.(*VU).runFn(0xc0001ab5c0, {0x1ac6480, 0xc0020a53c0}, 0xc0?, 0xc000010960, 0xc0008478f0, {0xc000847900, 0x1, 0x1})
        go.k6.io/[email protected]/js/runner.go:772 +0x28a
go.k6.io/k6/js.(*ActiveVU).RunOnce(0xc0020a5380)
        go.k6.io/[email protected]/js/runner.go:717 +0x412
go.k6.io/k6/lib/executor.getIterationRunner.func1({0x1ac6528, 0xc001f55770}, {0x1ab7420?, 0xc0020a5380?})
        go.k6.io/[email protected]/lib/executor/helpers.go:124 +0x64
go.k6.io/k6/lib/executor.PerVUIterations.Run.func5({0x1abdc88, 0xc0001ab5c0})
        go.k6.io/[email protected]/lib/executor/per_vu_iterations.go:227 +0x40a
created by go.k6.io/k6/lib/executor.PerVUIterations.Run
        go.k6.io/[email protected]/lib/executor/per_vu_iterations.go:240 +0xc29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant