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

Panic: Unexpected end of JSON input #987

Closed
5 tasks done
Tracked by #1138
inancgumus opened this issue Jul 31, 2023 · 4 comments
Closed
5 tasks done
Tracked by #1138

Panic: Unexpected end of JSON input #987

inancgumus opened this issue Jul 31, 2023 · 4 comments
Assignees
Labels
bug Something isn't working remote remote browser related

Comments

@inancgumus
Copy link
Member

inancgumus commented Jul 31, 2023

Brief summary

This problem was handled before in #793. But it seems the problem persists in some cases. Test run ID: 155041.

xk6-browser version

0fcdd36

OS

Linux

Docker version and image (if applicable)

No response

Steps to reproduce the problem

Run the same script in #986 several times on a restricted platform.

Expected behaviour

Not panics.

Actual behaviour

Panics.

panic: GoError: parsing remote object value: unexpected end of JSON input

goroutine 214897 [running]:
go.k6.io/k6/js/common.Throw(0x174df7b?, {0x19f6860?, 0xc0006b1740?})
	go.k6.io/k6@v0.45.1-0.20230725090219-9fb9b886ed4f/js/common/util.go:20 +0x4d
github.com/grafana/xk6-browser/k6ext.Panic.func1(0x1504b00?, {0xc0007dcb90?, 0x1594501?, 0xc00127b000?})
	github.com/grafana/xk6-browser@v1.0.0-rc0.0.20230726091449-0fcdd3618f29/k6ext/panic.go:35 +0x4a
github.com/grafana/xk6-browser/k6ext.sharedPanic({0x1a08080, 0xc01f6ec5f0}, 0xc0035877b8, {0xc0007dcb90?, 0x1, 0x1})
	github.com/grafana/xk6-browser@v1.0.0-rc0.0.20230726091449-0fcdd3618f29/k6ext/panic.go:64 +0x265
github.com/grafana/xk6-browser/k6ext.Panic({0x1a08080?, 0xc01f6ec5f0?}, {0x174df7b?, 0xc0000131d8?}, {0xc0007dcb90?, 0x18?, 0x18?})
	github.com/grafana/xk6-browser@v1.0.0-rc0.0.20230726091449-0fcdd3618f29/k6ext/panic.go:37 +0x65
github.com/grafana/xk6-browser/common.handleParseRemoteObjectErr({0x1a08080, 0xc01f6ec5f0}, {0x19f6760?, 0xc0220f91a0}, 0x2735d00?)
	github.com/grafana/xk6-browser@v1.0.0-rc0.0.20230726091449-0fcdd3618f29/common/remote_object.go:200 +0x132
github.com/grafana/xk6-browser/common.(*FrameSession).onConsoleAPICalled(0xc0192fae70, 0xc011710000)
	github.com/grafana/xk6-browser@v1.0.0-rc0.0.20230726091449-0fcdd3618f29/common/frame_session.go:598 +0x2be
github.com/grafana/xk6-browser/common.(*FrameSession).initEvents.func1()
	github.com/grafana/xk6-browser@v1.0.0-rc0.0.20230726091449-0fcdd3618f29/common/frame_session.go:252 +0x565
created by github.com/grafana/xk6-browser/common.(*FrameSession).initEvents
	github.com/grafana/xk6-browser@v1.0.0-rc0.0.20230726091449-0fcdd3618f29/common/frame_session.go:211 +0x1ab

Tasks

Preview Give feedback
@inancgumus inancgumus added bug Something isn't working remote remote browser related labels Jul 31, 2023
@ka3de
Copy link
Collaborator

ka3de commented Oct 9, 2023

Another occurrence of this happened in test_run:1988176.
Error happens here during JSON unmarshal, as object is not defined as UnserializableValue, then error is handled here which panics for being an unexpected error.

Whatever input is it, it does not fit into the currently supported categories. We should add support for a wider range of types as defined in CDP specs that might not work with a direct JSON deserialization.

@ka3de
Copy link
Collaborator

ka3de commented Dec 1, 2023

Another occurrence for test_run:2129017.

@ka3de
Copy link
Collaborator

ka3de commented Dec 1, 2023

Fixing all of the possible cases can be problematic, as often we can not reproduce the original script that caused the error. Nevertheless, based on discussions with k6 core, we should try to avoid panicking and stop the whole test for an error that might not have direct impact on it. Therefore I would say we should change the implementation to not panic, and instead provide an alternative implementation that still would allow us to be aware when these errors happen.

@inancgumus
Copy link
Member Author

we should change the implementation to not panic

Related: #688?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working remote remote browser related
Projects
None yet
Development

No branches or pull requests

3 participants