You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a mishandling of RemoteObject parsing when this one is of subtype null. This mishandling ends up on our implementation trying to unmarshal a nil value which ultimately results in a panic with error:
panic: GoError: parsing remote object value: unexpected end of JSON input
The concrete flow is the following:
parseRemoteObjectmethod is called with a cdpruntime.RemoteObject with subtype null and obj.UnserializableValue = ""
See example of received data:
Becuase UnserializableValue = "" the call is made to parseRemoteObjectValue.
We end up in the switch case for TypeObject, but because ObjectPreview is nil and val != Object, execution goes to the end of the function, where the value (nil in this case) will be attempted to be serialized, resulting the mentioned error.
Solution
We should add an explicit case inside TypeObject case in order to handle nullsubtype.
The xk6-browser execution finishes correctly, navigating to the website.
Actual behaviour
The execution crashes with the following error:
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)
WARN[0001] "Google Maps JavaScript API has been loaded directly without a callback. This is not supported and can lead to race conditions and suboptimal performance. For supported loading patterns please see https://goo.gle/js-api-loading" source=browser-console-api
WARN[0001] url:https://js.stripe.com/v3/m-outer-93afeeb17bc37e711759584dbfc50d47.html method:GET err:fetching response body: No resource with given identifier found (-32000) category="Response:bodySize:fetchBody" elapsed="0 ms" goroutine=386
WARN[0001] url:https://js.stripe.com/v3/fingerprinted/js/m-outer-8cb24ab2d649fd36a488d04d8c457933.js method:GET err:fetching response body: No resource with given identifier found (-32000) category="Response:bodySize:fetchBody" elapsed="0 ms" goroutine=386
WARN[0001] url:https://m.stripe.network/inner.html method:GET err:fetching response body: No resource with given identifier found (-32000) category="Response:bodySize:fetchBody" elapsed="0 ms" goroutine=315
WARN[0001] url:https://m.stripe.network/out-4.5.42.js method:GET err:fetching response body: No resource with given identifier found (-32000) category="Response:bodySize:fetchBody" elapsed="0 ms" goroutine=315
WARN[0002] url:https://m.stripe.com/6 method:POST err:fetching response body: No resource with given identifier found (-32000) category="Response:bodySize:fetchBody" elapsed="0 ms" goroutine=315
ERRO[0005] Failed to load resource: the server responded with a status of 429 () browser_source=network line_number=0 source=browser stacktrace="<nil>" url="https://o1012071.ingest.sentry.io/api/5977259/envelope/?sentry_key=e1363397e5574a048c87ce93858e83bf&sentry_version=7&sentry_client=sentry.javascript.nextjs%2F7.26.0"
WARN[0006] "/!\\ You are using legacy implementaion. Please update your code: use createWrapper() and wrapper.withRedux()." source=browser-console-api
WARN[0006] "/!\\ You are using legacy implementaion. Please update your code: use createWrapper() and wrapper.withRedux()." source=browser-console-api
WARN[0006] "/!\\ You are using legacy implementaion. Please update your code: use createWrapper() and wrapper.withRedux()." source=browser-console-api
WARN[0006] "/!\\ You are using legacy implementaion. Please update your code: use createWrapper() and wrapper.withRedux()." source=browser-console-api
WARN[0006] "/!\\ You are using legacy implementaion. Please update your code: use createWrapper() and wrapper.withRedux()." source=browser-console-api
WARN[0006] "/!\\ You are using legacy implementaion. Please update your code: use createWrapper() and wrapper.withRedux()." source=browser-console-api
WARN[0006] "/!\\ You are using legacy implementaion. Please update your code: use createWrapper() and wrapper.withRedux()." source=browser-console-api
WARN[0006] "/!\\ You are using legacy implementaion. Please update your code: use createWrapper() and wrapper.withRedux()." source=browser-console-api
panic: GoError: parsing remote object value: unexpected end of JSON input
running (00m06.1s), 1/1 VUs, 0 complete and 0 interrupted iterations
goroutine 101 [running]:-------------------------] 1 VUs 00m06.1s/10m0s 0/1 iters, 1 per VU
go.k6.io/k6/js/common.Throw(0x1407000?, {0x194cf40?, 0xc001f101a0?})
go.k6.io/k6@v0.42.1-0.20230130080633-582ec4d3940c/js/common/util.go:20 +0x4d
github.com/grafana/xk6-browser/k6ext.Panic({0x195c988, 0xc00276f1d0}, {0x167e2a5, 0x1f}, {0xc00061f9d0?, 0x1, 0x1})
github.com/grafana/xk6-browser@v0.0.0-00010101000000-000000000000/k6ext/panic.go:51 +0x2c6
github.com/grafana/xk6-browser/common.handleParseRemoteObjectErr({0x195c988, 0xc00276f1d0}, {0x194ce40?, 0xc0016a4468}, 0x0?)
github.com/grafana/xk6-browser@v0.0.0-00010101000000-000000000000/common/remote_object.go:195 +0x125
github.com/grafana/xk6-browser/common.(*FrameSession).onConsoleAPICalled(0xc00132c0b0, 0xc00088e000)
github.com/grafana/xk6-browser@v0.0.0-00010101000000-000000000000/common/frame_session.go:530 +0x1e5
github.com/grafana/xk6-browser/common.(*FrameSession).initEvents.func1()
github.com/grafana/xk6-browser@v0.0.0-00010101000000-000000000000/common/frame_session.go:249 +0x565
created by github.com/grafana/xk6-browser/common.(*FrameSession).initEvents
github.com/grafana/xk6-browser@v0.0.0-00010101000000-000000000000/common/frame_session.go:208 +0x1ab
See also the comparison between the console log messages in the k6 output vs the console.log message shown when navigating to the website through the browser:
Notice the null messages output in the browser console right at the moment that xk6-browser crashes.
First of all, great working narrowing down the cause.
Second, I see there is an orphaned PR for this, any idea if this fix can make it into the next version as it is blocking our large scale performance testing.
Hi @ArielKo1248 , the fix for this issue has just been merged into main, but won't be included in k6 until the next release. If you want you can use xk6 to build a custom version which includes k6 browser main version.
Brief summary
There is a mishandling of
RemoteObject
parsing when this one is of subtypenull
. This mishandling ends up on our implementation trying to unmarshal anil
value which ultimately results in a panic with error:The concrete flow is the following:
parseRemoteObject
method is called with acdpruntime.RemoteObject
with subtypenull
andobj.UnserializableValue
=""
See example of received data:
UnserializableValue
=""
the call is made toparseRemoteObjectValue
.TypeObject
, but becauseObjectPreview
isnil
andval
!=Object
, execution goes to the end of the function, where the value (nil
in this case) will be attempted to be serialized, resulting the mentioned error.Solution
We should add an explicit case inside
TypeObject
case in order to handlenull
subtype.See the CDP specs for remote object and possible values for
type
andsubtype
.xk6-browser version
v0.8.1
OS
Ubuntu 20.04.5 LTS
Chrome version
109.0.5414.119 (Official Build) (64-bit)
Docker version and image (if applicable)
No response
Steps to reproduce the problem
The problem can be reproduced with this script:
Expected behaviour
The xk6-browser execution finishes correctly, navigating to the website.
Actual behaviour
The execution crashes with the following error:
See also the comparison between the console log messages in the k6 output vs the console.log message shown when navigating to the website through the browser:
Notice the
null
messages output in the browser console right at the moment that xk6-browser crashes.Related: #777
The text was updated successfully, but these errors were encountered: