Error: Context is done before all 'IterEnd' events were processed

I am doing a POC for my team to try and implement K6 and looking to create a simple load of 10 VUs and 20 iterations i.e. 2 iterations per VU using ‘shared-iterations’ executor. But when I run it each time it runs approximately 15-18 users and ends with the warning error: Context is done before all ‘IterEnd’ events were processed

Version: k6 v0.46.0 (2023-08-14T13:23:26+0000/v0.46.0-0-gcbd9e9ad, go1.20.7, windows/amd64)

What I am interested to know is there are VUs available and maxTimeOut of 10mins is not reached but it still doesn’t run the iterations.

Note that the console doesn’t stop and kind of hangs there itself after this.

Am I missing something here?

import { browser } from 'k6/experimental/browser';
import { sleep, check } from 'k6';

export const options = {
    scenarios: {
        ui: {
            executor: 'shared-iterations',
            vus: 10,
            iterations: 20,
            options: {
                browser: {
                    type: 'chromium',
                },
            },
        },
    },
    thresholds: {
        checks: ["rate==1.0"]
    }
}

export default async function () {
    // const context = browser.newContext();
    console.log(browser.version());
    const page = browser.newPage({
        ignoreHTTPSErrors: true,
        }
    );

    try {
        /* Navigate to the url */
        await page.goto(URL);
        page.waitForTimeout(100);
        
        /* Login to the Web URL */
        const username = page.locator('[id="username"]');
        username.type('user1');
        const password = page.locator('[id="password"]');
        password.type('Abc@1234');
        
        const submitButton = page.locator('[id="loginFormUsernameAndPasswordButton"]');
        await Promise.all([page.waitForNavigation({
            timeout: 30000,
            waitUntil: 'domcontentloaded',
        }), submitButton.click(),]);
        page.waitForTimeout(1000);

        /* Click on My Account tab */
        const myAccountButton = page.locator('//button[contains(@id,\'myAccount\')]/span[contains(text(),\'MyAccount\')]');
        await Promise.all([myAccountButton.click(),]);
        // sleep(10);

        /* Click on Account Settings tab that appears on clicking My Account tab*/
        const accountSettingsButton = page.locator('//*[@id=\'myAccount_1077722406\']/a[1]');
        await Promise.all([page.waitForNavigation(), accountSettingsButton.click(),]);
        
        check(page, {
            'Account Page URL': p => p.url().match(/.*account/),
        });


    } finally {
        page.close();
    }
}

Hi @anilkothacheruvu,

But when I run it each time it runs approximately 15-18 users

What do you mean by this? I’ve ran some tests and when working with the shared-iterations executor where the vu count is 10 and iteration count is 20, I can see that 10 vus are running and working through the iterations. It’s not guaranteed that all the vus will each run through 2 iterations each. One vu could complete 1 or more than 2.

I’m unable to reproduce this issue. Any chance of you being able to recreate this on a public facing website?

Could you also provide the full output of the test?

What happens when you let the test run until the max duration of 10 minutes?

Cheers,
Ankur