grafana / k6

A modern load testing tool, using Go and JavaScript - https://k6.io
GNU Affero General Public License v3.0
26.17k stars 1.27k forks source link

K6 process doesn't terminates after completing its execution #4080

Open aupadhyay-coursera opened 3 days ago

aupadhyay-coursera commented 3 days ago

Brief summary

I am running K6 on an AWS Fargate cluster via a Jenkins pipeline. I have noticed that, more often than not, the K6 process does not terminate keeps on running even after running all the iterations. This issue halts the execution on the agent and prevents the agent from progressing to the next stage in the pipeline.

k6 version

0.53.0

OS

Arch Linux

Docker version and image (if applicable)

No response

Steps to reproduce the problem

  1. Utilizing K6 to execute browser load tests on an AWS Fargate Cluster with a configuration of 16 vCPUs and 32 GB RAM per agent, supporting 10 VUs (Virtual Users) per agent.
  2. Conducting UI load testing with the above configuration across 100 agents simultaneously.

Image

Expected behaviour

It Should move to next stage.

Actual behaviour

It keeps the agent in the same phase without exiting succesfully.

olegbespalov commented 2 days ago

Hi @aupadhyay-coursera !

To be able to figure out what and why is happening there, we need more details/context.

Would it be possible to share your script without revealing your business insights? Which output/configurations do you use? Would it be possible to increase verbosity (-v) and collect more logs?

aupadhyay-coursera commented 2 days ago

Output configuration:

K6_WEB_DASHBOARD=true K6_WEB_DASHBOARD_EXPORT=html-report.html K6_BROWSER_ARGS='no-sandbox,use-gl=swiftshader,disable-web-security,enable-unsafe-swiftshader,disable-webgl,disable-dev-shm-usage,ignore-certificate-errors' K6_BROWSER_HEADLESS=false k6 run .js

Here is test snippets

const startIndex = parseInt(__ENV.START_INDEX) || 0;
const endIndex = parseInt(__ENV.END_INDEX) || loginAccounts.length;

const assignedAccounts = loginAccounts.slice(startIndex, endIndex);
const iterationsPassed = new Counter('iterations_passed');
const iterationsFailed = new Counter('iterations_failed');

export const options = {
  scenarios: {
    ui: {
      executor: 'per-vu-iterations',
      vus: assignedAccounts.length, // Number of VUs is equal to the number of users
      iterations: 1, // Each user runs once
      maxDuration: '10m', // Max duration
      options: {
        browser: {
          type: 'chromium',
        },
      },
    },
  },
};

export default async function () {
  const user = assignedAccounts[__VU - 1];

/**
 * Performing user operations here
*/

 // Increment the passed iterations counter
    iterationsPassed.add(1);
  } 
  catch (error) {
    console.error(`Test failed for user ${user.email} at operation :`, error.message);
    iterationsFailed.add(1);
    await page.screenshot({ path: `screenshot.png` }); 
  } finally {
    await page.close();
  }
}

export function handleSummary(data) {
  return {
    'summary.json': JSON.stringify(data), //the default data object
  };
}
olegbespalov commented 1 day ago

Okay, so the script uses the browser module, and it's k6 v0.53.

I believe we saw such issues and there were a couple of fixes, that landed in recent k6 versions:

Please try running the latest k6 v0.55 and see if the issue remains there.