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

Broken since merge of https://github.com/grafana/xk6-browser/pull/876 #894

Closed
tmc opened this issue May 20, 2023 · 2 comments · Fixed by #905
Closed

Broken since merge of https://github.com/grafana/xk6-browser/pull/876 #894

tmc opened this issue May 20, 2023 · 2 comments · Fixed by #905
Assignees
Labels
bug Something isn't working
Milestone

Comments

@tmc
Copy link
Contributor

tmc commented May 20, 2023

Brief summary

I did some bisecting and as of 7982241 a very simple test is failing with a panic:

import { chromium } from 'k6/x/browser';

export default async function () {
  const browser = chromium.launch({});
  const page = browser.newPage();
  await page.goto('https://simple.wikipedia.org/');
}

Sample stacktrace:

ERRO[0000] panic: runtime error: invalid memory address or nil pointer dereference
goroutine 100 [running]:
runtime/debug.Stack()
	runtime/debug/stack.go:24 +0x64
go.k6.io/k6/js/common.RunWithPanicCatching.func1()
	go.k6.io/k6@v0.44.2-0.20230509145227-d951eace0c16/js/common/util.go:82 +0x198
panic({0x10200ff60, 0x102ec1d70})
	runtime/panic.go:884 +0x204
github.com/dop251/goja.(*Runtime).runWrapped.func1()
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/runtime.go:2516 +0x168
panic({0x10200ff60, 0x102ec1d70})
	runtime/panic.go:884 +0x204
github.com/dop251/goja.(*vm).handleThrow(0x14002256360, {0x10200ff60, 0x102ec1d70})
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/vm.go:788 +0x460
github.com/dop251/goja.(*vm).try.func1()
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/vm.go:807 +0x48
panic({0x10200ff60, 0x102ec1d70})
	runtime/panic.go:884 +0x204
github.com/dop251/goja.(*vm).handleThrow(0x14002256360, {0x10200ff60, 0x102ec1d70})
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/vm.go:788 +0x460
github.com/dop251/goja.(*vm).runTryInner.func1()
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/vm.go:830 +0x48
panic({0x10200ff60, 0x102ec1d70})
	runtime/panic.go:884 +0x204
github.com/grafana/xk6-browser/k6ext.GetVU({0x0?, 0x0?})
	github.com/grafana/xk6-browser@v0.9.0/k6ext/context.go:30 +0x20
github.com/grafana/xk6-browser/k6ext.Runtime({0x0?, 0x0?})
	github.com/grafana/xk6-browser@v0.9.0/k6ext/context.go:53 +0x24
github.com/grafana/xk6-browser/k6ext.sharedPanic({0x0, 0x0}, 0x14000e40730, {0x1400212db20?, 0x1, 0x1})
	github.com/grafana/xk6-browser@v0.9.0/k6ext/panic.go:41 +0x44
github.com/grafana/xk6-browser/k6ext.Panic({0x0?, 0x0?}, {0x101c24c4b?, 0x0?}, {0x1400212db20?, 0x0?, 0x0?})
	github.com/grafana/xk6-browser@v0.9.0/k6ext/panic.go:37 +0x58
github.com/grafana/xk6-browser/chromium.(*BrowserType).Launch(0x140025945a0?)
	github.com/grafana/xk6-browser@v0.9.0/chromium/browser_type.go:164 +0xb4
github.com/grafana/xk6-browser/browser.mapBrowserType.func2({0x1?, 0x1?})
	github.com/grafana/xk6-browser@v0.9.0/browser/mapping.go:734 +0xb4
reflect.Value.call({0x101fb5400?, 0x14000adca00?, 0x1034a4068?}, {0x101bf9fc1, 0x4}, {0x140007367f8, 0x1, 0x0?})
	reflect/value.go:586 +0x87c
reflect.Value.Call({0x101fb5400?, 0x14000adca00?, 0x14002594510?}, {0x140007367f8?, 0x1400212da90?, 0x140?})
	reflect/value.go:370 +0x90
github.com/dop251/goja.(*Runtime).wrapReflectFunc.func1({{0x102230e70, 0x140025815c0}, {0x14000e248b0, 0x1, 0x5}})
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/runtime.go:2056 +0x2e0
github.com/dop251/goja.(*nativeFuncObject).vmCall(0x14000e24540, 0x14002256360, 0x1)
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/func.go:559 +0x18c
github.com/dop251/goja.call.exec(0x2256360?, 0x14002256360)
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/vm.go:3366 +0x74
github.com/dop251/goja.(*vm).run(0x14002256360)
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/vm.go:582 +0x68
github.com/dop251/goja.(*vm).runTryInner(0x1400226b2d8?)
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/vm.go:834 +0x58
github.com/dop251/goja.(*generator).step(0x14000e0e540)
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/func.go:758 +0x30
github.com/dop251/goja.(*asyncRunner).start(0x14000e0e540, 0x1)
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/func.go:729 +0xc8
github.com/dop251/goja.(*baseJsFuncObject).asyncCall(0x14000e24600, {{0x1022317f0, 0x102f1bea0}, {0x1400212da30, 0x1, 0x1}}, 0x1400212da50)
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/func.go:607 +0x94
github.com/dop251/goja.(*asyncFuncObject).Call(...)
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/func.go:612
github.com/dop251/goja.AssertFunction.func1.1()
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/runtime.go:2476 +0x6c
github.com/dop251/goja.(*vm).try(0x14002256360, 0x14000533628)
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/vm.go:811 +0x1dc
github.com/dop251/goja.(*Runtime).runWrapped(0x14002152400, 0x140005a0000?)
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/runtime.go:2520 +0x64
github.com/dop251/goja.AssertFunction.func1({0x1022317f0?, 0x102f1bea0?}, {0x1400212da30?, 0x1?, 0x1?})
	github.com/dop251/goja@v0.0.0-20230402114112-623f9dda9079/runtime.go:2475 +0x78
go.k6.io/k6/js.(*VU).runFn.func2.1()
	go.k6.io/k6@v0.44.2-0.20230509145227-d951eace0c16/js/runner.go:826 +0x54
go.k6.io/k6/js/eventloop.(*EventLoop).Start(0x14000adc640, 0x14002594240)
	go.k6.io/k6@v0.44.2-0.20230509145227-d951eace0c16/js/eventloop/eventloop.go:177 +0x174
go.k6.io/k6/js.(*VU).runFn.func2()
	go.k6.io/k6@v0.44.2-0.20230509145227-d951eace0c16/js/runner.go:825 +0xe4
go.k6.io/k6/js/common.RunWithPanicCatching({0x102234e28?, 0x14000117980?}, 0x140005338a8?, 0x100d7c218?)
	go.k6.io/k6@v0.44.2-0.20230509145227-d951eace0c16/js/common/util.go:86 +0x74
go.k6.io/k6/js.(*VU).runFn(0x14000e01540, {0x1022241f8, 0x14000addcc0}, 0x80?, 0x140007367b0, 0x1400212da20, {0x1400212da30, 0x1, 0x1})
	go.k6.io/k6@v0.44.2-0.20230509145227-d951eace0c16/js/runner.go:824 +0x1e8
go.k6.io/k6/js.(*ActiveVU).RunOnce(0x14001395140)
	go.k6.io/k6@v0.44.2-0.20230509145227-d951eace0c16/js/runner.go:769 +0x358
go.k6.io/k6/lib/executor.getIterationRunner.func1({0x1022242a0, 0x14002589e90}, {0x102217840?, 0x14001395140?})
	go.k6.io/k6@v0.44.2-0.20230509145227-d951eace0c16/lib/executor/helpers.go:81 +0x4c
go.k6.io/k6/lib/executor.PerVUIterations.Run.func5({0x10221e948, 0x14000e01540})
	go.k6.io/k6@v0.44.2-0.20230509145227-d951eace0c16/lib/executor/per_vu_iterations.go:228 +0x370
created by go.k6.io/k6/lib/executor.PerVUIterations.Run
	go.k6.io/k6@v0.44.2-0.20230509145227-d951eace0c16/lib/executor/per_vu_iterations.go:241 +0x9a0

The error is getting swallowed but appears to be https://github.com/grafana/xk6-browser/blob/main/common/browser_options.go#L80

xk6-browser version

HEAD

OS

MacOS

Chrome version

latest

Docker version and image (if applicable)

No response

Steps to reproduce the problem

see above

Expected behaviour

no panic

Actual behaviour

panic

@tmc tmc added the bug Something isn't working label May 20, 2023
@ka3de
Copy link
Collaborator

ka3de commented May 22, 2023

Hi @tmc , thank you for your contribution!
We are aware of this issue, as it's a leftover from #876 (see this comment's second point), and we plan to fix it before the next release.
Our recommendation is to use tagged versions of xk6-browser repo, as the main branch is not guaranteed to be always in a stable state.

@tmc
Copy link
Contributor Author

tmc commented May 22, 2023

@ka3de I understand, it makes it hard to contribute improvements with an unstable HEAD.

@ka3de ka3de self-assigned this May 24, 2023
@ka3de ka3de added this to the v0.10.0 milestone May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants