xk6-browser
xk6-browser copied to clipboard
Deadlock in the cloud
The browser test seems to dead-lock after 3-10min. This is likely not related to the cloud, but it's easiest to spot it there because the metrics stop being generated while k6 continues to run.
- CPU drops to near 0%.
- The memory stays constant. (which probably means that the chromium process is running)
- no iterations are being executed
- no browser metrics are being collected
Sample script:
import { check } from 'k6';
import { chromium } from 'k6/x/browser';
export let options = {
vus: 1,
duration: '50m'
}
export default function () {
const browser = chromium.launch('chromium', {
headless: true,
});
const context = browser.newContext();
const page = context.newPage();
// Goto front page, find login link and click it
page.goto('https://test.k6.io/', { waitUntil: 'networkidle' });
const elem = page.$('a[href="/my_messages.php"]');
elem.click().then(() => {
// Enter login credentials and login
page.$('input[name="login"]').type('admin');
page.$('input[name="password"]').type('123');
return page.$('input[type="submit"]').click();
}).then(() => {
// We expect the above form submission to trigger navigation, so wait for it
// and the page to be loaded.
page.waitForNavigation();
check(page, {
'header': page.$('h2').textContent() == 'Welcome, admin!',
});
}).finally(() => {
page.close();
browser.close();
});
}
We think the deadlock issue in the cloud (#496) is the same as issue as the test timeout issue in waitForExecutionContext (#482).
The fix and further details will be raised in #482, unless we find something else.
We believe that this has been resolved (for now) with PR #555 (issue #553, which was created due to the deadlock issue). We have ran several tests locally and int he cloud and it hasn't resurfaced yet. There's a chance that this could still occur though (obviously in case we missed anything) if the CDP events are sent out of order by the browser.