Panic mode under Load test

Hi,

I’m running k6 v0.26.1 (dev build, go1.13, windows/amd64) and I seem to run into an issue.
Whether I use 10, 100 or 350Vus does not change a thing. It does work sometimes with 350 and can also crash with 10.

export let options = {
	stages: [
		{ duration: "5m", target: 10}, .
		{ duration: "10m", target: 10},
		{ duration: "5m", target: 0 }, 
	]
};

The test starts and after a while stops with the panic log under.
Does anyone has any idea what can cause it? I did manage to run the exact same test with over 300 VUs.
I’m running K6 locally on a dedicated test server. CPU, memory and disk usage are all under 50%.

Running [===================panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x30 pc=0xa48c2c]f

Hi @Airchtit,

that is very strange indeed. Can you post your entire script, or relevant parts of it that reproduce the issue? Can you also test your script on a Linux or macOS machine to pinpoint if this only affects Windows?

Sure. Here is the ultra simplified version of the script that still fails.
Note this is a Postman export but it worked well earlier.
if someone could explain to me the postman[Post].pop(); line while we’re at it, I’d be very grateful.

// Auto-generated by the Load Impact converter

import "./libs/shim/core.js";
import "./libs/shim/expect.js";
import "./libs/shim/urijs.js";
import { group } from "k6";

export let options = {
	stages: [
		{ duration: "5m", target: 5 }, // simulate ramp-up of traffic from 1 to 100 users over 5 minutes.
		{ duration: "10m", target: 5 }, // stay at 50 users for 5 minutes
		{ duration: "5m", target: 0 }, // ramp-down to 0 users
	]
};

const Post = Symbol.for("post");
const Request = Symbol.for("request");
postman[Symbol.for("initial")]({
	options,
	environment: {
		username: "username",
		password: "password",
		"base-url": "URL",
		token:"FGJWH8PMgN55T489Mw3120sgcP_asVeDYxeYUYTAR7jQ4GTlKixTTD725DNVfK7wF9xutMnPY3IKdbCC-CXjxFaQQtLMewTILY-2OnJdHcOUPvoPGON60X3AibwR7tT6"
	}
});

export default function() {

	group("Auth", function() {
		postman[Request]({
			name: "GenerateToken",
			id: "b01d5cb4-4c98-4dde-8ae7-b4f5dfed7a88",
			method: "POST",
			address: "{{base-url}}/arcgis/tokens/generateToken",
			data: {
				username: "{{username}}",
				password: "{{password}}",
				referer: "{{base-url}}/arcgis/tokens/",
				client: "referer",
				expiration: "100000",
				f: "json"
			},
			headers: {
				accept: "application/json",
				Referer: "{{base-url}}"
			}
		});
	});

	postman[Post].pop();
}

Out of curiosity, i tried replacing the options with the following and this gave me no error (for the last 10 minutes at least).

export let options = { 
	maxRedirects: 4, 
	vus: 350,
	iterations: 1000000
};

Am I doing something wrong with the ramping up? Am I poorly using the stage option?

Thanks. While I’m trying to reproduce your issue, can you try using the latest k6 binary from the official releases page? Its k6 version should be k6 v0.26.1 (2020-02-24T08:10:13+0000/v0.26.1-0-g4c49f9a3, go1.13.8, windows/amd64). This is to discard any issues with your local k6 build.

And please test the same script on Linux or macOS if you can, to see if the issue is generic or specific to Windows.

Also, please post the full stack trace when the error happens, not just the panic message. It should have a list of function calls, filenames, etc.

Am I doing something wrong with the ramping up? Am I poorly using the stage option?

No, your stages configuration is OK.

I just ran a variation of your script (with the URL changed to test against https://httpbin.test.loadimpact.com) and I didn’t notice any issues. The test ran for 20m and finished without errors. I used the v0.26.1 Windows version I posted above.

So I’m inclined to think the problem is with your dev k6 version or your Windows environment. Please try a binary from the releases page and let us know.

if someone could explain to me the postman[Post].pop(); line while we’re at it, I’d be very grateful.

I’m not familiar with the inner-workings of the postman-to-k6 converter, but it seems that postman[Post] is an array of functions that process the k6 response, so that call to pop() would remove the last one added. It seems that you are able to define these handlers at the global level and at the request level, but I don’t think you need that pop() call if you’re not using them. Someone more familiar with the converter can correct me.

1 Like

Hi and thank you for taking the time to answer.
It looks like switching to the release version fixed my issue.

I haven’t been at work and have not had the opportunity to test on other environments than Windows but I guess this should be investigated.