Closed LaserPhaser closed 2 years ago
Hi, thanks for reporting this!
Unfortunately I'm not able to reproduce it on current main
(baaf58c). Running a slight variation of your script:
import launcher from 'k6/x/browser';
export let options = {
scenarios: {
constant_request_rate: {
executor: 'constant-arrival-rate',
rate: 1,
timeUnit: '1000m', // 1000 iterations per second, i.e. 1000 RPS
duration: '1000m',
preAllocatedVUs: 500, // how large the initial pool of VUs would be
maxVUs: 5000, // if the preAllocatedVUs are not enough, we can initialize more
},
},
};
export default function () {
const browser = launcher.launch('chromium', {headless: false, devtools: true,});
const context = browser.newContext({
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X; zh-CN) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/16B92 UCBrowser/12.1.7.1109 Mobile AliApp(TUnionSDK/0.1.20.3)',
isMobile: true,
viewport: {width: 600, height: 800}
});
const page = context.newPage();
const resp = page.goto('https://httpbin.test.k6.io/get', {waitUntil: 'load'});
console.log(resp.json()['headers']['User-Agent']);
page.close();
browser.close();
}
Outputs:
INFO[0001] Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X; zh-CN) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/16B92 UCBrowser/12.1.7.1109 Mobile AliApp(TUnionSDK/0.1.20.3) source=console
As expected. It also doesn't happen for google.com
, I just changed the URL so that I could output the User Agent.
Can you reproduce it consistently? What OS are you using? And which xk6-browser version (compiled by yourself or the v0.1.0 binary release)?
I don't think we've seen that stack trace before, so it's definitely an issue we'll look into. It would just help if we could reproduce it consistently.
Thanks!
@imiric sorry i'm unable to check it on @main cause the problem with build [#121]
Yep it's stable reproducible OS
sw_vers
ProductName: macOS
ProductVersion: 11.5.2
BuildVersion: 20G95
xk6-browser@main
Commit baaf58caef73
xk6 v0.34.1
Check it When I use https it's working fine When I switch to http it cause an error
import launcher from 'k6/x/browser';
export let options = {
scenarios: {
constant_request_rate: {
executor: 'constant-arrival-rate',
rate: 1,
timeUnit: '1000m', // 1000 iterations per second, i.e. 1000 RPS
duration: '1000m',
preAllocatedVUs: 500, // how large the initial pool of VUs would be
maxVUs: 5000, // if the preAllocatedVUs are not enough, we can initialize more
},
},
};
export default function () {
const browser = launcher.launch('chromium', {headless: false, devtools: true,});
const context = browser.newContext({
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X; zh-CN) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/16B92 UCBrowser/12.1.7.1109 Mobile AliApp(TUnionSDK/0.1.20.3)',
isMobile: true,
viewport: {width: 600, height: 800}
});
const page = context.newPage();
const resp = page.goto('http://google.com', {waitUntil: 'load'});
console.log(resp.json()['headers']['User-Agent']);
page.close();
browser.close();
}
Oh lol There is a comment in code already) https://github.com/grafana/xk6-browser/blob/main/common/frame_session.go#L416
Working just fine without throwing error ))
Yup, but that's a different issue from yours :) (#120)
I think this one is the same as #126, for which we have a PR in review: #127. If you can build a binary from the fix/126-invalid-memory-frame-currentDocument-request
branch and confirm if it fixes your issue, we'd appreciate it.
I've tried to build the K6 binary:
xk6 build --output xk6-browser --with github.com/grafana/xk6-browser@bdda1c92e95b4d6657cd202f038b0516b48e1cb5
As well I've tried to build plugin locally from the branch
xk6 build --output k6 --with github.com/grafana/xk6-browser='/Users/untitled/work/grafana/xk6-browser'
But the error still there in both cases:
panic: unable to parse remote object value: cannot extract value when remote object ID is given
goroutine 78 [running]:
go.k6.io/k6/js/common.Throw(0x1d18b80, {0x217d820, 0xc008484fa0})
go.k6.io/k6@v0.35.0/js/common/util.go:36 +0x55
github.com/grafana/xk6-browser/common.k6Throw({0x219d588, 0xc0082f7380}, {0x1f2c241, 0x27}, {0xc005053cb0, 0x1, 0x1})
github.com/grafana/xk6-browser@v0.1.1-0.20211118144950-bdda1c92e95b/common/helpers.go:338 +0x1ae
github.com/grafana/xk6-browser/common.(*FrameSession).onConsoleAPICalled(0xc0086b4600, 0xc000cb4730)
github.com/grafana/xk6-browser@v0.1.1-0.20211118144950-bdda1c92e95b/common/frame_session.go:417 +0x357
github.com/grafana/xk6-browser/common.(*FrameSession).initEvents.func1()
github.com/grafana/xk6-browser@v0.1.1-0.20211118144950-bdda1c92e95b/common/frame_session.go:207 +0x357
created by github.com/grafana/xk6-browser/common.(*FrameSession).initEvents
github.com/grafana/xk6-browser@v0.1.1-0.20211118144950-bdda1c92e95b/common/frame_session.go:180 +0xe7
I'm confused... That error is the one from #120, which we're working on fixing. The original stack trace from this issue is a different error, which #127 should resolve. Let's not mix both things.
Can you reproduce this current issue on commit bdda1c92e?
Oh sorry (looks like i'm blind ) ), it's my fault, no I can't reproduce the original issue. I see only the new one from #120
So seems #127 has been resolved.
runtime error: invalid memory address or nil pointer dereference has happened looks like its because of
UserAgent
:userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_1 like Mac OS X; zh-CN) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/16B92 UCBrowser/12.1.7.1109 Mobile AliApp(TUnionSDK/0.1.20.3)'
Reproducer:
Exception: