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

Concurrent write error with waitForEvent.js example script #1048

Closed
Tracked by #1138
ankur22 opened this issue Sep 26, 2023 · 3 comments
Closed
Tracked by #1138

Concurrent write error with waitForEvent.js example script #1048

ankur22 opened this issue Sep 26, 2023 · 3 comments
Assignees
Labels
bug Something isn't working next Might be eligible for the next planning (not guaranteed!)

Comments

@ankur22
Copy link
Collaborator

ankur22 commented Sep 26, 2023

Brief summary

When running the waitForEvent.js example script in the CI it is failing (not on all runs though) on fatal error: concurrent map writes. I'm unable to reproduce this locally though. My initial guess is that the predicateFn call needs to be made on the taskqueue like we do for page.on('console').

xk6-browser version

a7598e1

OS

NA

Chrome version

NA

Docker version and image (if applicable)

NA

Steps to reproduce the problem

Run the examples/waitForEvent.js test script in the CI and it might result in an error. It doesn't seem to occur on all runs. I've failed to reproduce it locally.

Expected behaviour

The test to run without any issues.

Actual behaviour

The test fails with the following output:

fatal error: concurrent map writes

goroutine 58 [running]:
github.com/dop251/goja.(*Runtime).fieldsInfo(0xc002428800, {0x19eef48, 0x168f480})
	github.com/dop251/goja@v0.0.0-20230919151941-fc55792775de/object_goreflect.go:627 +0xbc
github.com/dop251/goja.(*objectGoReflect).init(0xc002a702a0)
	github.com/dop251/goja@v0.0.0-20230919151941-fc55792775de/object_goreflect.go:150 +0x50b
github.com/dop251/goja.(*Runtime).toValue(0xc002428800, {0x16cb400?, 0xc001bca340?}, {0x0?, 0x0?, 0x1?})
	github.com/dop251/goja@v0.0.0-20230919151941-fc55792775de/runtime.go:1919 +0x1885
github.com/dop251/goja.(*Runtime).ToValue(...)
	github.com/dop251/goja@v0.0.0-20230919151941-fc55792775de/runtime.go:1735
github.com/grafana/xk6-browser/common.(*BrowserContext).runWaitForEventHandler(0xc0023822c0, {0x19da488, 0xc000faa910}, 0xc0023cbf20, 0xc0023cbf80, 0xc00004e420, 0xc001ceb260)
	github.com/grafana/xk6-browser@v1.0.2/common/browser_context.go:442 +0x39d
created by github.com/grafana/xk6-browser/common.(*BrowserContext).waitForEvent in goroutine 55
	github.com/grafana/xk6-browser@v1.0.2/common/browser_context.go:382 +0x286

goroutine 1 [chan receive]:
go.k6.io/k6/execution.(*Scheduler).Run(0xc000ee08c0, {0x19da488, 0xc0000945f0}, {0x19da450, 0xc00070f560}, 0xc002320c00)
	go.k6.io/k6@v0.46.1-0.20230926095547-6fa8abddf10c/execution/scheduler.go:[472](https://github.com/grafana/xk6-browser/actions/runs/6311217342/job/17134781659?pr=1047#step:7:473) +0xc6e
go.k6.io/k6/cmd.(*cmdRun).run(0xc00006c340, 0xc0001c1680, {0xc000088960?, 0x1, 0x2})
	go.k6.io/k6@v0.46.1-0.20230926095547-6fa8abddf10c/cmd/run.go:352 +0x1531
github.com/spf13/cobra.(*Command).execute(0xc0001c1680, {0xc000088940, 0x2, 0x2})
	github.com/spf13/cobra@v1.4.0/command.go:856 +0x694
github.com/spf13/cobra.(*Command).ExecuteC(0xc0002c8c80)
	github.com/spf13/cobra@v1.4.0/command.go:974 +0x38d
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.4.0/command.go:902
go.k6.io/k6/cmd.(*rootCommand).execute(0xc0002b51d0)
	go.k6.io/k6@v0.46.1-0.20230926095547-6fa8abddf10c/cmd/root.go:104 +0x125
go.k6.io/k6/cmd.Execute()
	go.k6.io/k6@v0.46.1-0.20230926095547-6fa8abddf10c/cmd/root.go:137 +0x2f
main.main()
goroutine 96 [select]:
github.com/grafana/xk6-browser/common.contextWithDoneChan.func1()
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:61 +0x7c
created by github.com/grafana/xk6-browser/common.contextWithDoneChan in goroutine 27
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:59 +0xb6

goroutine 126 [select]:
github.com/grafana/xk6-browser/common.contextWithDoneChan.func1()
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:61 +0x7c
created by github.com/grafana/xk6-browser/common.contextWithDoneChan in goroutine 27
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:59 +0xb6

goroutine 138 [select]:
github.com/grafana/xk6-browser/common.contextWithDoneChan.func1()
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:61 +0x7c
created by github.com/grafana/xk6-browser/common.contextWithDoneChan in goroutine 27
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:59 +0xb6

goroutine 149 [select]:
github.com/grafana/xk6-browser/common.contextWithDoneChan.func1()
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:61 +0x7c
created by github.com/grafana/xk6-browser/common.contextWithDoneChan in goroutine 27
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:59 +0xb6

goroutine 135 [select]:
github.com/grafana/xk6-browser/common.contextWithDoneChan.func1()
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:61 +0x7c
created by github.com/grafana/xk6-browser/common.contextWithDoneChan in goroutine 27
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:59 +0xb6

goroutine 145 [select]:
github.com/grafana/xk6-browser/common.contextWithDoneChan.func1()
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:61 +0x7c
created by github.com/grafana/xk6-browser/common.contextWithDoneChan in goroutine 27
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:59 +0xb6

goroutine 140 [select]:
github.com/grafana/xk6-browser/common.contextWithDoneChan.func1()
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:61 +0x7c
created by github.com/grafana/xk6-browser/common.contextWithDoneChan in goroutine 27
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:59 +0xb6

goroutine 152 [select]:
github.com/grafana/xk6-browser/common.contextWithDoneChan.func1()
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:61 +0x7c
created by github.com/grafana/xk6-browser/common.contextWithDoneChan in goroutine 27
	github.com/grafana/xk6-browser@v1.0.2/common/context.go:59 +0xb6
Error: Process completed with exit code 2.
@ankur22 ankur22 added the bug Something isn't working label Sep 26, 2023
@inancgumus
Copy link
Member

Thanks! It might be because of the concurrency issue as in page.On as you said 👍 Before the task queue starts infiltrating much into the business logic; my humble suggestion is to abstract it in the mapping layer while solving this problem :)

@inancgumus
Copy link
Member

@inancgumus inancgumus added the next Might be eligible for the next planning (not guaranteed!) label Nov 30, 2023
@ankur22
Copy link
Collaborator Author

ankur22 commented Feb 26, 2024

I believe this issue has been resolved by #447, and some refactoring in #1187.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working next Might be eligible for the next planning (not guaranteed!)
Projects
None yet
Development

No branches or pull requests

2 participants