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

invalid memory address or nil pointer dereference with default test file #51

Closed
alex88 opened this issue Nov 6, 2022 · 1 comment · Fixed by #52
Closed

invalid memory address or nil pointer dereference with default test file #51

alex88 opened this issue Nov 6, 2022 · 1 comment · Fixed by #52

Comments

@alex88
Copy link

alex88 commented Nov 6, 2022

Hi, this is my test file taken from https://grafana.com/docs/loki/next/clients/k6/

import loki from 'k6/x/loki';

const timeout = 5000; // ms
const conf = new loki.Config("http://127.0.0.1:3100", timeout);
const client = new loki.Client(conf);

export default () => {
   client.pushParameterized(2, 512*1024, 1024*1024);
};

however I'm getting:

❯ ./k6 run -v test.js
DEBU[0000] Logger format: TEXT
DEBU[0000] k6 version: v0.41.0 ((devel), go1.19.2, linux/amd64)

          /\      |‾‾| /‾‾/   /‾‾/
     /\  /  \     |  |/  /   /  /
    /  \/    \    |     (   /   ‾‾\
   /          \   |  |\  \ |  (‾)  |
  / __________ \  |__| \__\ \_____/ .io

DEBU[0000] Resolving and reading test 'test.js'...
DEBU[0000] Loading...                                    moduleSpecifier="file:///tmp/xk6-loki/test.js" originalModuleSpecifier=test.js
DEBU[0000] 'test.js' resolved to 'file:///tmp/xk6-loki/test.js' and successfully loaded 233 bytes!
DEBU[0000] Gathering k6 runtime options...
DEBU[0000] Initializing k6 runner for 'test.js' (file:///tmp/xk6-loki/test.js)...
DEBU[0000] Detecting test type for...                    test_path="file:///tmp/xk6-loki/test.js"
DEBU[0000] Trying to load as a JS test...                test_path="file:///tmp/xk6-loki/test.js"
DEBU[0000] Babel: Transformed                            t=24.380721ms
DEBU[0000] url=http://localhost:3100 timeoutMs=5000 protobufRatio=NaN cardinalities=map[]
WARN[0000] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID
DEBU[0000] Runner successfully initialized!
DEBU[0000] Parsing CLI flags...
DEBU[0000] Consolidating config layers...
DEBU[0000] Parsing thresholds and validating config...
DEBU[0000] Initializing the execution scheduler...
DEBU[0000] Starting 1 outputs...                         component=output-manager
DEBU[0000] Starting...                                   component=metrics-engine-ingester
DEBU[0000] Started!                                      component=metrics-engine-ingester
  execution: local
     script: test.js
     output: -

  scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
           * default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

DEBU[0000] Starting the REST API server on localhost:6565
DEBU[0000] Initialization starting...                    component=engine
DEBU[0000] Starting emission of VUs and VUsMax metrics...
DEBU[0000] Start of initialization                       executorsCount=1 neededVUs=1 phase=local-execution-scheduler-init
DEBU[0000] url=http://localhost:3100 timeoutMs=5000 protobufRatio=NaN cardinalities=map[]
DEBU[0000] Start of initialization                       executorsCount=1 neededVUs=1 phase=local-execution-scheduler-init                                                                                                                                      [61/1638]
DEBU[0000] url=http://localhost:3100 timeoutMs=5000 protobufRatio=NaN cardinalities=map[]
WARN[0000] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID
DEBU[0000] Initialized VU #1                             phase=local-execution-scheduler-init
DEBU[0000] Finished initializing needed VUs, start initializing executors...  phase=local-execution-scheduler-init
DEBU[0000] Initialized executor default                  phase=local-execution-scheduler-init
DEBU[0000] Initialization completed                      phase=local-execution-scheduler-init
DEBU[0000] Execution scheduler starting...               component=engine
DEBU[0000] Start of test run                             executorsCount=1 phase=local-execution-scheduler-run
DEBU[0000] Running setup()                               phase=local-execution-scheduler-run
DEBU[0000] Metrics processing started...                 component=engine
DEBU[0000] url=http://localhost:3100 timeoutMs=5000 protobufRatio=NaN cardinalities=map[]
WARN[0000] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID
DEBU[0000] Start all executors...                        phase=local-execution-scheduler-run
DEBU[0000] Starting executor                             executor=default startTime=0s type=per-vu-iterations
DEBU[0000] Starting executor run...                      executor=per-vu-iterations iterations=1 maxDuration=10m0s scenario=default type=per-vu-iterations vus=1
ERRO[0000] panic: runtime error: invalid memory address or nil pointer dereference
goroutine 106 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
go.k6.io/k6/js/common.RunWithPanicCatching.func1()
        go.k6.io/k6@v0.41.0/js/common/util.go:82 +0x191
panic({0x156c900, 0x2829f50})
        runtime/panic.go:884 +0x212
github.com/dop251/goja.(*Runtime).runWrapped.func1()
        github.com/dop251/goja@v0.0.0-20221003171542-5ea1285e6c91/runtime.go:2437 +0xdc
panic({0x156c900, 0x2829f50})
        runtime/panic.go:884 +0x212
github.com/dop251/goja.(*vm).try.func1()
        github.com/dop251/goja@v0.0.0-20221003171542-5ea1285e6c91/vm.go:626 +0x70f
panic({0x156c900, 0x2829f50})
        runtime/panic.go:884 +0x212
github.com/mstoykov/atlas.(*Node).ValueByKey(0x1558700?, {0x17f33cf?, 0x20?})
        github.com/mstoykov/atlas@v0.0.0-20220808085829-90340e9998bd/atlas.go:45 +0x20
go.k6.io/k6/metrics.(*TagSet).Get(...)
        go.k6.io/k6@v0.41.0/metrics/tags.go:58
go.k6.io/k6/lib/netext/httpext.MakeRequest({0x1aa10a0, 0xc001f14c40}, 0xc002bb0c00, 0xc001deb320)
        go.k6.io/k6@v0.41.0/lib/netext/httpext/request.go:172 +0x9af
github.com/grafana/xk6-loki.(*Client).send(_, _, {_, _, _}, _)
        github.com/grafana/xk6-loki@v0.0.0-00010101000000-000000000000/client.go:296 +0x9f4
github.com/grafana/xk6-loki.(*Client).pushBatch(_, _)
        github.com/grafana/xk6-loki@v0.0.0-00010101000000-000000000000/client.go:264 +0x12b
github.com/grafana/xk6-loki.(*Client).PushParameterized(_, _, _, _)
        github.com/grafana/xk6-loki@v0.0.0-00010101000000-000000000000/client.go:240 +0x1e5
reflect.Value.call({0x16e6480?, 0xc002dd1740?, 0x7f784c7ea108?}, {0x17667d4, 0x4}, {0xc00131bf40, 0x3, 0xc000c09090?})
        reflect/value.go:584 +0x8c5
reflect.Value.Call({0x16e6480?, 0xc002dd1740?, 0xc002bd5630?}, {0xc00131bf40?, 0xc002bd5678?, 0x16e6480?})
        reflect/value.go:368 +0xbc
github.com/dop251/goja.(*Runtime).wrapReflectFunc.func1({{0x1ab7878, 0xc002c6f740}, {0xc0010cedd0, 0x3, 0xd}})
        github.com/dop251/goja@v0.0.0-20221003171542-5ea1285e6c91/runtime.go:1980 +0x1da
github.com/dop251/goja.(*vm)._nativeCall(0xc002eeaa00, 0xc000d983c0, 0x3)
        github.com/dop251/goja@v0.0.0-20221003171542-5ea1285e6c91/vm.go:3233 +0x1e3
github.com/dop251/goja.call.exec(0xf0facd?, 0xc002eeaa00)
        github.com/dop251/goja@v0.0.0-20221003171542-5ea1285e6c91/vm.go:3205 +0x14d
github.com/dop251/goja.(*vm).run(0xc002eeaa00)
        github.com/dop251/goja@v0.0.0-20221003171542-5ea1285e6c91/vm.go:495 +0x8b
github.com/dop251/goja.(*baseJsFuncObject)._call(0xc0027937a0, {0xc000d8a840?, 0x1, 0x433590?}, {0x0?, 0x0}, {0x0?, 0x0?})
        github.com/dop251/goja@v0.0.0-20221003171542-5ea1285e6c91/func.go:318 +0x3f8
github.com/dop251/goja.(*arrowFuncObject).Call(0x0?, {{0x1ab81f8, 0x2882c60}, {0xc000d8a840, 0x1, 0x1}})
        github.com/dop251/goja@v0.0.0-20221003171542-5ea1285e6c91/func.go:284 +0x57
github.com/dop251/goja.AssertFunction.func1.1()
        github.com/dop251/goja@v0.0.0-20221003171542-5ea1285e6c91/runtime.go:2397 +0x74
github.com/dop251/goja.(*vm).try(0xc002eeaa00, 0x203000?)
        github.com/dop251/goja@v0.0.0-20221003171542-5ea1285e6c91/vm.go:634 +0x18a
github.com/dop251/goja.(*Runtime).runWrapped(0xc00299ee00, 0x8?)
        github.com/dop251/goja@v0.0.0-20221003171542-5ea1285e6c91/runtime.go:2441 +0x7c
github.com/dop251/goja.AssertFunction.func1({0x1ab81f8?, 0x2882c60?}, {0xc000d8a840?, 0x1?, 0x1?})
        github.com/dop251/goja@v0.0.0-20221003171542-5ea1285e6c91/runtime.go:2396 +0x92
go.k6.io/k6/js.(*VU).runFn.func2.1()
        go.k6.io/k6@v0.41.0/js/runner.go:774 +0x43
go.k6.io/k6/js/eventloop.(*EventLoop).Start(0xc00131b630, 0xc001060f30)
        go.k6.io/k6@v0.41.0/js/eventloop/eventloop.go:171 +0x1b7
go.k6.io/k6/js.(*VU).runFn.func2()
        go.k6.io/k6@v0.41.0/js/runner.go:773 +0xeb
go.k6.io/k6/js/common.RunWithPanicCatching({0x1abd620?, 0xc00051fc00?}, 0x40f6e6?, 0x1588080?)
        go.k6.io/k6@v0.41.0/js/common/util.go:86 +0x87
go.k6.io/k6/js.(*VU).runFn(0xc000d8ea80, {0x1aa10a0, 0xc001f14c40}, 0x20?, 0xc002e0ba70, 0xc000d8a820, {0xc000d8a840, 0x1, 0x1})
        go.k6.io/k6@v0.41.0/js/runner.go:772 +0x28a
go.k6.io/k6/js.(*ActiveVU).RunOnce(0xc001f14c00)
        go.k6.io/k6@v0.41.0/js/runner.go:717 +0x412
go.k6.io/k6/lib/executor.getIterationRunner.func1({0x1aa1148, 0xc001057b30}, {0x1a92360?, 0xc001f14c00?})
        go.k6.io/k6@v0.41.0/lib/executor/helpers.go:124 +0x64
go.k6.io/k6/lib/executor.PerVUIterations.Run.func5({0x1a98bc8, 0xc000d8ea80})
        go.k6.io/k6@v0.41.0/lib/executor/per_vu_iterations.go:227 +0x40a
created by go.k6.io/k6/lib/executor.PerVUIterations.Run
        go.k6.io/k6@v0.41.0/lib/executor/per_vu_iterations.go:240 +0xc29

Goja stack:
native
DEBU[0000] Executor finished successfully                executor=default startTime=0s type=per-vu-iterations
DEBU[0000] Running teardown()                            phase=local-execution-scheduler-run
DEBU[0000] url=http://localhost:3100 timeoutMs=5000 protobufRatio=NaN cardinalities=map[]
WARN[0000] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID
DEBU[0000] Metrics emission of VUs and VUsMax metrics stopped
DEBU[0000] Execution scheduler terminated                component=engine error="a panic occurred during JS execution: runtime error: invalid memory address or nil pointer dereference"
DEBU[0000] Processing metrics and thresholds after the test run has ended...  component=engine
DEBU[0000] Stopping...                                   component=metrics-engine-ingester
DEBU[0000] run: execution scheduler returned an error    component=engine error="a panic occurred during JS execution: runtime error: invalid memory address or nil pointer dereference"
DEBU[0000] Stopped!                                      component=metrics-engine-ingester
DEBU[0000] Engine run terminated cleanly

running (00m00.0s), 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
DEBU[0000] Engine: Thresholds terminated                 component=engine
DEBU[0000] url=http://localhost:3100 timeoutMs=5000 protobufRatio=NaN cardinalities=map[]
WARN[0000] Running in multi-tenant-mode. Each VU has its own X-Scope-OrgID

     data_received....................: 0 B    0 B/s
     data_sent........................: 0 B    0 B/s
     iteration_duration...............: avg=12.8ms min=12.8ms med=12.8ms max=12.8ms p(90)=12.8ms p(95)=12.8ms
     iterations.......................: 1      72.706814/s
     loki_client_lines................: 2050   149048.969421/s
     loki_client_uncompressed_bytes...: 302 kB 22 MB/s

DEBU[0000] Waiting for engine processes to finish...
DEBU[0000] Metrics processing winding down...            component=engine
DEBU[0000] Everything has finished, exiting k6!
DEBU[0000] Stopping 1 outputs...                         component=output-manager
DEBU[0000] Stopping...                                   component=metrics-engine-ingester
DEBU[0000] Stopped!                                      component=metrics-engine-ingester
ERRO[0000] a panic occurred during JS execution: runtime error: invalid memory address or nil pointer dereference

any idea why? I'm using kubectl port forward and it doesn't even seem it's trying to connect to it

mstoykov added a commit that referenced this issue Nov 6, 2022
This was forgotten by me when moving to v0.41 :(

closes #51
@mstoykov mstoykov mentioned this issue Nov 6, 2022
chaudum pushed a commit that referenced this issue Nov 7, 2022
This was forgotten by me when moving to v0.41 :(

closes #51
@alex88
Copy link
Author

alex88 commented Nov 7, 2022

Thank you!

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

Successfully merging a pull request may close this issue.

1 participant